#include <iostream>
using namespace std;
long long n,m,b[100005],a[20000005],c,suma;
long long stepen (long long x,long long y){
    long long pr=1;
for (int i=1;i<=y;i++){
pr*=x;
}
return pr;
}
int main  () {
    suma=0;
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<=n;j++){
    a[i+b[j]]=a[i+j];
    }
}
for (int i=1;i<=n;i++){
        suma+=stepen(c,i)+a[i];
}
cout<<suma%998244353<<endl;
return 0;
}