#include <bits/stdc++.h>
using namespace std;
const int module = 	998244353;

int power(long x, unsigned long y, int p) { 
    int res = 1;
    x = x % p;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
} 

int main() {
	long m, n;	
	cin >> n >> m;
	
	vector<long> A(n+1), B(m+1);
		
	for(long i = 0 ; i < m ; i++)
		cin >> B[i+1];
			
	long c;
	cin >> c;	
		
	for(long i = 0 ; i <= n ; i++)
		A[i+1] = i+1;
		
	
	for(long i = 0 ; i <= n - m ; i++)
		for (int j = 1; j <= m; j++)
			A[i + B[j]] = A[i + j];
		
	long long x = 0;
	
	for(long i = 1 ; i <= n ; i++)
		x += (power(c,i,module) * A[i] % module) % module; 
	
	cout << x % module << endl;			
}