#include <iostream>
#include <cmath>
#include <math.h>
using namespace std;


int main(){
   signed long long int c=0;
	unsigned  long int i,j;
	unsigned  long int m;
	unsigned long long int n;
	signed long long int x=0;
signed long long int s=0;
cin>>n>>m;
unsigned long int nizB[m];
unsigned long long int nizA[n];

for(i=1; i<=m; i++){
	cin>>nizB[i];
}
cin>>c;
for(i=1; i<=n; i++){
	nizA[i]=i;
}


for(i=0; i<=(n-m); i++){
	for(j=1; j<=m; j++){
		nizA[i+nizB[j]] = nizA[i+j];
                    	}
			s=s+(pow(c,i+1) * nizA[i+1]);			  } 
              	


for(i=(n-m)+2; i<=n; i++){
	
	s=s+(pow(c,i) * nizA[i]);
}

x=s % 998244353;
cout<<x;



}