#include <bits/stdc++.h>

#define ll long long
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 998244353

using namespace std;

ll n,m,b[100100],a[22000100],c;

int main(){
    cin>>n>>m;
    for (int i=1;i<=n;i++)a[i]=i;
    for(int i=1;i<=m;i++)cin>>b[i];
    cin>>c;

    for (int i=0;i<=n-m;i++){
        for (int j=1;j<=m;j++){
            a[i+b[j]]=a[i+j];
        }
    }
    int ans=0,r=1;
    for (int i=1;i<=n;i++){
        r*=c;
        ans+=((r*a[i])%mod);
        ans%=mod;
    }
    cout<<ans;
    return 0;
}