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

int main()
{
    int n, m, c, x = 0;
    scanf("%d %d", &n, &m);

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

    scanf("%d", &c);

    int a[n];
    for(int i = 1; i <= n; ++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];
    }

    for(int i = 1; i <= n; ++i)
        x += (stepen(c, i)*a[i]) % 998244353;

    printf("%d", x);

    return 0;
}
int stepen(int osnova, int n)
{

    int i, p;
    p = 1;
    for(i = 1; i <= n; ++i)
        p = p * osnova;

    return p;
}