#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n, m;
    cin >> n >> m;
    long long B[m+1];
    for (long long i=1; i<=m; ++i)
        cin >> B[i];
    long long c;
    cin >> c;
    long long A[n+1];
    for (long long i=1; i<=n; ++i)
        A[i]=i;
    for (long long i=0; i<=n-m; ++i){
        for (long long j=1; j<=m; j++)
            A[i + B[j]] = A[i + j];
    }
    long long x=0, pr=1;
    for (long long i=1; i<=n; ++i){
        pr*=c;
        x+=(pr*A[i]%998244353);
    }
    cout << x%998244353;
    return 0;
}