using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace vrednostDodele
{
    class Program
    {
        static void Main(string[] args)
        {
            //prvi red ulaza
            string[] ulaz1 = Console.ReadLine().Split();
            int n = Convert.ToInt32(ulaz1[0]);
            int m = Convert.ToInt32(ulaz1[1]);

            //drugi red ulaza
            int[] b = new int[m];
            string[] ulaz2 = Console.ReadLine().Split();
            for (int br1 = 0; br1 < m; br1++)
            {
                b[br1] = Convert.ToInt32(ulaz2[br1]);
            }

            //treci red ulaza
            int c = Convert.ToInt32(Console.ReadLine());

            //niz A
            int[] a = new int[n];
            for(int br2 = 0; br2 < n; br2++)
            {
                a[br2] = br2 + 1;
            }

            for (int i = 0; i <= n - m; i++)
            {
                for (int j = 0; j < m; j++)
                    a[i + b[j] - 1] = a[i + j];
            }

            int x = 0;
            for(int br3 =0; br3 < n; br3++)
            {
                x += (int)Math.Pow(c, br3+1) * a[br3];
            }

            int rez = x % 998244353;
            Console.WriteLine(rez);

            Console.ReadLine();
        }
    }
}