#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

ll a[10000005];
ll b[10000005];

const ll MOD = 998244353;

ll add(ll a, ll b){
    return (a+b+MOD)%MOD;
}

ll mul(ll a, ll b){
    a %= MOD;
    b %= MOD;
    return (a*b)%MOD;
}

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=n; i++){
        a[i] = i;
    }
    for(int i=1; i<=m; i++){
        cin >> b[i];
    }
    ll c;
    cin >> c;
    for(int i=0; i<=n-m; i++){
        for(int j=1; j<=m; j++){
            a[i+b[j]] = a[i+j];
        }
    }
    ll sum=0;
    ll rc = 1;
    for(int i=1; i<=n; i++){
        rc = mul(c, rc);
        sum = add(sum, mul(rc, a[i]));
    }
    cout << sum;
    return 0;
}