#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n, m;
	int input;
	int c;
	int x = 0;
	cin >> n >> m;

	vector<int> b = {0};
	vector<int> a = {0};

	for (int i = 0; i < m; i++) { //input sistem

		cin >> input;
		b.push_back(input);
		
	}
	
	cin >> c;


	for (int i = 0; i < n; i++) {
		
		a.push_back(i+1);

	}

	

	for (int i = 0; i <= n - m; i++) {
		for (int j = 1; j <= m; j++) {
			a[i + b[j]] = a[i + j];

		}
	}






for (int i = 1; i <= n; i++) {
	int d = 1;
	for (int pow = 1; pow <= i; pow++) {
		d = d * c;
	}
	
	
	x = x + ((d*a[i]) % 998244353);



}

cout << x;
	return 0;
}