#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const ll N = 1e6*20+3,M = 1e5+21;
ll b[M],a[N];
ll add(ll x,ll y){
    x += y;
    if(x >= mod){
        x -= y;
    }
    return x;
}
ll mult(ll x,ll y){
    return (x*y)%mod;
}
ll fp(ll x,ll y){
    if(y == 0){
        return 1;
    }
    ll p = fp(x,y/2);
    p = (p*p)%mod;
    if(y % 2 == 1){
        p = (p*x)%mod;
    }
    return p;
}
int main(){
    ios_base::sync_with_stdio(false);
    ll n,m,sol = 0,c;
    cin >> n >> m;
    for(long i = 1; i <= m; i++){
        cin >> b[i];
    }
    cin >> c;
    for(long i = 1; i <= n; i++){
        a[i] = i;
    }
    for(long i = 0; i <= n-m; i++){
        for(long j = 1; j <= m; j++){
            a[i+b[j]] = a[i+j];
        }
    }
    for(long i = 1; i <= n; i++){
        sol = add(sol,mult(a[i],fp(c,i)));
    }
    cout << sol << endl;
}