#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int mod = 998244353;

int main() {	
	// #ifndef ONLINE_JUDGE
	// freopen("../../in.txt", "r", stdin);
	// #endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, m, c;
	cin >> n >> m;

	vector <int> b(m+1);

	for (int i = 1; i <= m; i++) 
		cin >> b[i];

	vector <int> a(n+1);

	for (int i = 0; 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];
		}
	}

	cin >> c;

	long long sum = 0;

	for (int i = a.size() - 1; i > 0; i--) {
		sum += a[i];
		sum *= c;
		sum %= mod;
	}

	cout << sum << endl;

/*
	sum += ( a[i] * c^i ) % mod;
	
	sum = 1 * c + 2 * c^2 + 3 * c^3

	sum ((((3 * c) + 2) * c) + 1) * c 
*/

	return 0;
}