#include<cstdio>
#include<iostream>
#include<cmath>
#define ll long long
using namespace std;
ll mod=998244353,rez,cnt,c;
int a[20000000],b[100010],n,m,bsize,last_iter,rng,change[200010],pom[200010],l,r;
void ispis(){
   for(int i=1;i<=n;i++)printf("%d ",a[i]);
   printf("\n");
}
int main(){

//    freopen("test.txt","r",stdin);
//    freopen("moj.out","w",stdout);


    scanf("%d %d",&n,&m);

    for(int i=1;i<=m;i++){
        scanf("%d",&b[i]);
    }

    cin>>c;

    m=100000;
    n=20000000;

    last_iter=n-m+1;
    bsize=10000;
    if(10000>=last_iter)bsize=(int)sqrt(last_iter);

    for(int i=1;i<=m;i++){
        b[i]=rand()%m+1;
    }
    c=100;

   for(int i=1;i<=n;i++)a[i]=i;

    for(int i=0;i<bsize;i++){
        for(int j=1;j<=m;j++)
            a[i+b[j]]=a[i+j];
    }

    rng=bsize+m-1;

    for(int i=1;i<=bsize+m-1;i++){
        change[i]=a[i];
    }

    l=1;
    r=bsize;
/*
    while(1){

       r+=bsize;
       l+=bsize;
       if(r>last_iter)break;

       for(int i=1;i<=rng;i++){
           pom[i]=a[l-1+change[i]];
       }

       for(int i=1;i<=rng;i++)
        a[l+i-1]=pom[i];

    }

    for(int i=l;i<=n-m;i++){
        for(int j=1;j<=m;j++)
            a[i+b[j]]=a[i+j];
    }
    */

    ///ispis();

    cnt=1;
    for(int i=1;i<=n;i++){
       cnt=(cnt*c)%mod;
       rez=((((ll)(cnt*(ll)a[i]))%mod)+rez)%mod;
    }
    printf("%lld\n",rez);

return 0;
}