#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
using namespace std;

int b[100001], *a;

int main() {
	int m, n, c, x=0, mod=998244353;
	scanf("%d%d", &n, &m);
	for (int i=0; i<m; i++) {
		scanf("%d", &b[i]);
	}
	scanf("%d", &c);
	a = (int*)calloc(n, sizeof(int));
	for (int i=0; i<n; i++) {
		a[i] = i+1;
	}
	
	for (int i=0; i<=n-m; i++) {
		for (int j=1; j<=m; j++) {
			a[i+b[j-1]-1] = a[i+j-1];
		}
	}
	
	for (int i=1; i<=n; i++) {
		x += pow(c, i)*a[i-1];
	}
	
	x = x%mod;
	printf("%d", x);
}