#include <stdio.h>
#include <cmath>

long long b[100000];
long long a[20000000];

int main()
{
	long long n, m, c, x = 0;
	scanf("%lld %lld", &n, &m);
	for (int i = 1; i <= m; i++)
	{
		scanf("%lld", &b[i]);
	}
	for (int i = 1; i <= n; i++)
	{
		a[i] = i;
	}
	for (int i = 0; i <= n - m; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			a[i + b[j]] = a[i + j];
		}
	}
	scanf("%lld", &c);
	for (int i = 1; i <= n; i++)
	{
		x += pow(c, i)*a[i];
	}
	printf("%lld", x % 998244353);
	return 0;
}