#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>

#define ull long long unsigned
using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<ull> B(M+1);
	for (int i = 1; i <= M; i++) {
		cin >> B[i];
	}
	vector<ull> A(N + 1);
	for (int i = 1; i < N + 1; 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];
		}
	}
	
	long long  C;
	cin >> C;
	long long sum = 0;
	for (int i = 1; i <= N; i++) {
		sum += powl(C,i) * A[i];
	}
	
	cout << sum % 998244353;
}