#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n, m;
    cin >> n >> m;
    long long A[n+1], B[m+1];
    for (int i = 1; i <= n; i++) {
        A[i] = i;
    }
    for (int i = 1; i <= m; i++) {
        cin >> B[i];
    }
    for (int i = 0; i <= n-m; i++) {
        for (int j = 1; j <= m; j++)
            A[i + B[j]] = A[i + j];
    }
    long long s = 0;
    long long c;
    long long mod = 998244353;
    cin >> c;
    for (long long i = 1; i <= n; i++) {
        s += (long long)(pow(c, i) * A[i]) % mod;
    }
    cout << s;
    return 0;
}