#include<iostream>
#include<iostream>
using namespace std;

int main()
{
	long  C,M,N,B[1000],A[1000],Z,R,p;
	cin>>N>>M;
	for(int e=0;e<M;e++)
	{
		cin>>B[e];
	}
		for(int k=1;k<=N;k++)
	{
		A[k]=k;
	}
	p=N-M;
	for(int i=0;i<=p;i++)
	{
		for (int j=1; j<=M; j++)
         A[i + B[j]] = A[i + j];
	}

	cin>>C;
	long C1,c[1000];

	C1=C;
	for(int t=1;t<=N;t++)
	{	
		Z=Z+C*A[t];
     	C=C*C1;
	}
	
	R=Z%998244353;
	cout<<R;
}