#include<iostream>
#include<iomanip>

using namespace std;

main()
{
	int i,j,N,M,C,X=0,k,p;
	cin>>N;
	cin>>M;
	int b[M],a[N];
	for (i=1;i<=M;i++)
	cin>>b[i];
	cin>>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++)
	{
		p=1;
		for (k=1;k<=i;k++)
		p=p*C;
		X=X+(p*a[i]);
	}
	if ((X>0)&&(X<998244353))
	cout<<X;
}