#include <cstdio>
#include <iostream>
#include <vector>
#define modd 998244353
using namespace std;
vector < long long int > d;
vector < long long int > u;
vector < long long int > b;
int main()
{
	long long int n,m,i,j,k,c,c1;
	scanf("%lld%lld",&n,&m);
	b.resize(m+2);
	d.resize(n+2);
	for (i=0;i<m;i++)
	{
		scanf("%lld",&b[i+1]);
	};
	scanf("%lld",&c);
	c1=c;
	for (i=1;i<n;i++) d[i]=i;
	for (i=0;i<=n-m;i++)
	{
		for (j=1;j<=m;j++) d[i+b[j]]=d[i+j];
		
	};
//	for (i=0;i<n;i++) cout << d[i] << " ";
//	cout << "\n";
	long long int summ=0LL;
	for (i=1;i<=n;i++)
	{
		summ+=(c*d[i])%modd;
		summ=summ%modd;
		c=(c*c1)%modd;
	};
	cout << summ;
	return 0;
	
}