#include <bits/stdc++.h>

using namespace std;

long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr), cerr.tie(nullptr);
    int n, m, c;
    cin >> n >> m;
    vector<int> a(n+1), b(m+1);
    for (int i = 1; i<=m; i++)
        cin >> b[i];
    for (int i = 1; i<=n; ++i)
        a[i] = i;

    for (int i = 0; i<=n-m; ++i)
        for (int j=1; j<=m; ++j)
            a[i + b[j]] = a[i + j];
    cin >> c;
    long long x = 0;
    for (int i = 1; i<=n; i++) {
        x += ((binpow(c, i) * a[i]) % 998244353);
    }
    cout << "\n" << x << endl;
    return 0;
}