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

typedef long long ll;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MAXN = 2e7+100;

ll M = 998244353LL;
ll n, m, c, b[100005], a[20000005];

int main(int argc, char** argv) {
	IOS
	cin >> n >> m;
	for(ll i = 1; i <= m; i++){
		cin >> b[i];
	}
	for(ll i = 1; i <= n; i++){
		a[i] = i;
	}
	for(ll i = 0; i <= n-m; i++){
		for (ll j = 1; j <= m; j++)
  			a[i + b[j]] = a[i + j];
	}
	cin >> c;
	ll x = 0;
	for(ll i = 1; i <= n; i++){
		x += (ll)(pow(c, i) * a[i]) % M;
	}
	cout << x;
	return 0;
}