#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define pii pair<int,int>
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define forn(a,b,c) for(int a=b;a<=c;a++)
#define ford(a,b,c) for(int a=b;a>=c;a--)
const int N=5e5+5;
int a[N],b[N],c,n,m,ans,pc;
const int mod=998244353;
int add(int x, int y){ x+=y;if(x>=mod) x-=mod;return x;}
int sub(int x, int y){ x-=y;if(x<0) x+=mod;return x;}
int mul(int x, int y){ x=(ll)x*y%mod;return x;}
int main()
{
    scanf("%d%d",&n,&m);
    forn(i,1,m){
        scanf("%d",&b[i]);
    }
    scanf("%d",&c);
    pc=c;
    forn(i,1,n){
        a[i]=i;
    }
    forn(i,0,n-m){
        forn(j,1,m){
            a[i+b[j]]=a[i+j];
        }
    }
    forn(i,1,n){
        //printf("%d ",a[i]);
        ans=add(ans,mul(c,a[i]));
        c=mul(c,pc);
    }
    printf("%d\n",ans);
    return 0;
}