#include <bits/stdc++.h>

using namespace std;
#define int long long

const int mod = 998244353;

int pow2(int a, int k){
	a %= mod;
    if (k == 0)
    return 1;

    if (k == 1)
    return a;

    int tmp = pow2(a, k / 2) % mod;
    tmp = tmp * tmp;
    tmp %= mod;
    if (k & 1)
    tmp = (tmp * a) % mod;
    return tmp;
}	


signed main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(nullptr); 
	cout.tie(nullptr); 
	cerr.tie(nullptr);	
	
	int n, m;
	cin >> n >> m;

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

	int a[n + 1];
	for (int i = 0; i <= n; ++i)
		a[i] = i % mod;

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

	int sol = 0;
	for (int i = 1; i <= n; ++i){
		sol += (pow2(c, i) * a[i]) % mod; 
		sol %= mod;
	}

	cout << sol << '\n';
}