#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int Max = 1 << 14, P = 479 << 21 | 1;
const ll g = 3;
ll wn[20];
inline ll ksm(ll a, ll b, const ll &mod){
ll s = 1;
while(b){
if(b & 1) s = s * a % mod;
b >>= 1;
a = a * a % mod;
}
return s;
}
void change(ll s[], int len){
for(int i = 1, j = len >> 1, k; i < len - 1; i++){
if(i < j) swap(s[i], s[j]);
k = len >> 1;
while(j >= k){
j -= k;
k >>= 1;
}
if(j < k) j += k;
}
}
void NTT(ll s[], int len, int on){
change(s, len);
for(int id = 0, h = 2; h <= len; h <<= 1){
id++;
for(int j = 0; j < len; j += h){
ll w = 1;
for(int k = j; k < j + (h >> 1); k++){
ll u = s[k] % P, t = w * s[k + (h >> 1)] % P;
s[k] = (u + t) % P;
s[k + (h >> 1)] = (u - t + P) % P;
w = w * wn[id] % P;
}
}
}
if(on == -1){
for(int i = 1; i < (len >> 1); i++) swap(s[i], s[len - i]);
ll inv = ksm(len, P - 2, P);
for(int i = 0; i < len; i++) s[i] = s[i] * inv % P;
}
}
ll Getg(const ll &x){
ll t = x - 1, p[20];
p[0] = 0;
for(ll i = 2; i * i <= t; i++){
if(t % i == 0){
p[++p[0]] = i;
while(t % i == 0) t /= i;
}
}
if(t != 1) p[++p[0]] = t;
bool flag;
for(ll i = 1; i <= x; i++){
flag = true;
for(int j = 1; j <= p[0]; j++)
if(ksm(i, (x - 1) / p[j], x) == 1){
flag = false;
break;
}
if(flag) return i;
}
}
int n, m, x, s;
ll a[Max] = {0}, b[Max] = {0};
int ref[8000 + 10];
int main(){
for(int i = 0; i < 20; i++) wn[i] = ksm(g, (P ^ 1) >> i, P);
scanf("%d %d %d %d", &n, &m, &x, &s);
ll gg = Getg(m);
for(int t = 1, i = 0; i < m - 1; i++){
ref[t] = i;
t = t * gg % m;
}
for(int t, i = 1; i <= s; i++){
scanf("%d", &t);
if(t) a[ref[t]] = 1;
}
m--;// m = phi(m);
int len = 1;
while(len <= (m << 1)) len <<= 1;
for(int i = 0; i <= m; i++) b[i] = a[i];
n--;
while(n){
NTT(a, len, 1);
if(n & 1){
NTT(b, len, 1);
for(int i = 0; i < len; i++) b[i] = b[i] * a[i] % P;
NTT(b, len, -1);
for(int i = m; i < len; i++){
b[i % m] = (b[i % m] + b[i]) % P;
b[i] = 0;
}
}
n >>= 1;
if(!n) break;
for(int i = 0; i < len; i++) a[i] = a[i] * a[i] % P;
NTT(a, len, -1);
for(int i = m; i < len; i++){
a[i % m] = (a[i % m] + a[i]) % P;
a[i] = 0;
}
}
printf("%lld\n", b[ind[x % m]]);
return 0;
}