#include <bits/stdc++.h>
#define int long long
using namespace std;

const int mod = 998244353;
int n, m, a[1000010], b[100010], ans, c, c1;

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> m;
	for(int i = 0; i < n; ++i){
		a[i+1] = i+1;
	}
	for(int i = 1; i <= m; ++i){
		cin >> b[i];
	}
	cin >> c;
	for(int i = 0; i <= n-m; ++i){
		for(int j = 1; j <= m; ++j){
			a[i+b[j]] = a[i+j];
		}
	}
	c %= mod;
	if(c < 0){
		c += mod;
	}
	c1 = c;
	for(int i = 1; i <= n; ++i){
		ans += (c1*a[i])%mod;
		if(ans >= mod){
			ans -= mod;
		}
		c1 *= c;
		c1 %= mod;
	}
	cout << ans;
}