#include<iostream>

using namespace std;

int main()
{
	long  C,M,N,B[100000],A[1000000],Z,R;
	cin>>N>>M;
	for(long e=0;e<M;e++)
	{
		cin>>B[e];
	}
		for(long k=1;k<=N;k++)
	{
		A[k]=k;
	}
	for(long i=0;i<=M-N;i++)
	{
		for (long j=1; j<=M; j++)
         A[i + B[j]] = A[i + j];
	}
	cin>>C;
	long long C1=C;
	for(long t=1;t<=N;t++)
	{
		Z=Z+C*A[t];
		C=C*C1;
	}
	R=Z%998244353;
	cout<<R;
}