#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define mod 998244353
#define pb push_back
#define mid(l, r) ((l)+(r))/2
#define len(a) (a).length()
#define sz(a) (a).size()
#define xx first
#define yy second
#define inf int(2e9)
#define ff(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i, a, b) for(int (i) = (a); (i) >= (b); --(i))


using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

template<class T>
void print(const T niz[], const int siz)
{
    for(int i=0;i<siz;i++)
        cout << niz[i] << " ";
    cout << endl;
}

int n,m;
ll niz1[100005];
ll niz2[100005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    ff(i,1,m){
        cin >> niz1[i];
    }
    ff(i,1,n){
        niz2[i] = i;
    }
    ff(i,0,n-m){
        ff(j,1,m){
            niz2[i + niz1[j]] = niz2[i + j];
        }
    }
    ll c;
    cin >> c;
    ll tmp = c;
    ll sum = 0;
    ff(i,1,n){
        sum = (sum + ((tmp * niz2[i])%mod))%mod;
        tmp *= c;
        tmp %= mod;
    }
    cout << sum << endl;
    return 0;
}