#include <bits/stdc++.h>

using namespace std;

#define NUM 1000000007 // prime modulo value 
  
long int fastpow(long long a, long long b) 
{ 
    if (b == 0) 
        return 1; 
  
    if (b == 1) 
        return a;
  
    long int t = fastpow(a, b / 2); 
    t = (t * t) % NUM; 
  
    if (b % 2 == 0) 
        return t; 
  
    else
        return ((a % NUM) * t) % NUM; 
} 

int main(){
	
	long long N, M, C, X=0;
	
	cin>>N;
	cin>>M;
	
	long long A[N+1], B[M+1];
	
	for(long long i=1; i<=M; i++){
		cin>>B[i];
	}
	
	cin>>C;
	
	for(long long i=1; i<=N; i++){
		A[i]=i;	
	}
	for(long long i=0; i<=N-M; i++)
		for (long long j=1; j<=M; j++){
  			A[i + B[j]] = A[i + j];
		}
  			
  	for(long long i=1; i<=N; i++){
  		X+=(long long)(fastpow(C,i)*A[i])%998244353;
	}
	  
	cout<<X;  
	
	return 0;
}