#include <stdio.h>
#include<math.h>
int main()
{
    unsigned long long int N,M,i,j;
    
    
    scanf("%llu %llu",&N,&M);
    
    unsigned long long int B[M];
    unsigned long long int A[N],C,X,SUM=0;
    //unsigned long long int tomb[(N-M)+2]
    for(i=0;i<M;i++){
        scanf("%llu",&B[i]);
        
    }
    scanf("%llu",&C);
    for(i=1;i<=N;i++){
        A[i]=i;
    }
    
    
    for(i=0;i<=N-M;i++){
        for(j=1;j<=M;j++){
            A[i+B[j]]=A[i+j];
        }
        
    }
    
    for(i=1;i<=N;i++){
       SUM=SUM+ pow(C,i)*A[i];
    }
    
    X=SUM%998244353;
    printf("%llu",X);
    return 0;
}