#include <bits/stdc++.h>
#define debug(x) cout << #x << " is " << x << '\n';
#define stigao() cout << "Stigao" < < < '\n';
#define file() freopen("output.txt", "w", stdout);

using namespace std;

typedef long long ll;

const ll mod = 998244353;

ll fast_pow(ll base, ll power){
    ll result = 1;
    while(power > 0) {
        if(power & 1) {
            result = (result * base) % mod;
        }
        base = (base * base) % mod;
        power >>= 1;
    }
    return result;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll n, m, c;
    cin >> n >> m;
    ll b[m + 1], a[n + 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;
    ll sum = 0;
    for(int i = 1; i <= n; i++){
        sum += (fast_pow(c, i) * (a[i] % mod)) % mod;
    }
    cout << sum;
    return 0;
}