#include <iostream>
//#include<string>
int B[20000000], A[20000000];
int main()
{
	int n, m, c;
	std::cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		std::cin >> B[i];
		
	}
	for (int i = 0; i <= n; i++)
		A[i] = i;
	std::cin >> c;
	for (int i = 0; i <= n - m; i++) {
		for (int j = 1; j <= m; j++)
			A[i + B[j]] = A[i + j];
	}
	long long int p = 1, x=0;
	for (int i = 1; i <= n; i++) {
		p = p * c;
		x = x + p * A[i];
	}
	/*for (int i = 1; i <= n; i++)
		std::cout << A[i];*/
	//std::cout << "\n";
	std::cout << x%998244353;
	//return 0;
}