#include <iostream>
#include <vector>

using std::vector;

int main()
{
    int N, M;
    std::cin >> N >> M;
    vector<int> B;
    vector<int> A;
    for (int i = 0; i != M; ++i) {
        int Bi = 0;
        std::cin >> Bi;
        B.push_back(Bi);
        A.push_back(i + 1);
    }
    for (int i = M; i != N; ++i)
        A.push_back(i + 1);

    const int till = N - M;
    for (int i = 0; i <= till; ++i)
        for (int j = 1; j <= M; ++j)
            A[i+B[j-1]-1] = A[i+j-1];
    int C;
    std::cin >> C;

    long long res = 0;
    for (int i = N; i >= 1; --i)
        res = C*(res + A[i - 1]);
    
    if (res < 998244353)
        std::cout << res << std::endl;
    else
        std::cout << res%998244353 << std::endl;

    return 0;
}