#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 -= mod;
    }
    return x;
}
ll mult(ll x,ll y){
    return (x*y)%mod;
}
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];
        }
    }
    ll pw = c%mod;
    for(long i = 1; i <= n; i++){
        sol = add(sol,mult(a[i],pw));
        pw = mult(pw,c);
    }
    cout << sol << endl;
}