#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int stepen(int, int);
int main()
{
    int n, m, b[100000], i, c, a[20000000], broj = 998244353, C, x = 0;

    scanf("%d %d", &n, &m);

    for(i = 1; i <= m; i++)
        scanf("%d", &b[i]);

    scanf("%d", &c);

    for(i = 1; i <= n; i++)
        a[i] = i;

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

    C = c;
    for(i = 1; i < n; i++){
        C = (int) pow(c, i);
        x += (stepen(c, i)*a[i])%broj;
    }

    printf("%d", x);

    return 0;
}

int stepen(int n, int i)
{
    int result = 0;
    while (i != 0)
    {
        result *= n;
        --i;
    }

    return result;
}