#include <iostream>

using namespace std;

int main()
{
    int n, m;
    long long suma = 0, m1;
    long long suma1, x = 998244353;
    cin >> n >> m;
    int b[m], a[n];
    for (int i = 1; i <= m; i++) {
        cin >> b[i];
    }
    int c;
    cin >> c;
    int k = c;
    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++) {
            int p = b[j];
            a[i + p] = a[i + j];
        }
    }
    for (int i = 1; i <= n; i++) {
        m1 = a[i] * c;
        c *= k;
        suma += m1;
    }
    suma1 = suma % x;
    cout << suma1;



    return 0;
}