#include<cstdio>
#include<cctype>
#include<queue>
#include<cstring>
#include<algorithm>
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define dwn(i,s,t) for(int i=s;i>=t;i--)
#define ren for(int i=first[x];i;i=next[i])
using namespace std;
const int BufferSize=1<<16;
char buffer[BufferSize],*head,*tail;
inline char Getchar() {
if(head==tail) {
int l=fread(buffer,1,BufferSize,stdin);
tail=(head=buffer)+l;
}
return *head++;
}
inline int read() {
int x=0,f=1;char c=Getchar();
for(;!isdigit(c);c=Getchar()) if(c==‘-‘) f=-1;
for(;isdigit(c);c=Getchar()) x=x*10+c-‘0‘;
return x*f;
}
const int maxn=18010;
const int p=1004535809;
const int G=3;
const int NUM=15;
typedef long long ll;
ll wn[maxn],inv;
ll pow(ll n,ll m,ll mod=p) {
ll ans=1;
for(;m;m>>=1,(n*=n)%=mod) if(m&1) (ans*=n)%=mod;
return ans;
}
void NTT(ll* A,int len,int tp) {
int j=len>>1,c=0;
rep(i,1,len-2) {
if(i<j) swap(A[i],A[j]);int k=len>>1;
while(j>=k) j-=k,k>>=1;j+=k;
}
for(int i=2;i<=len;i<<=1) {
c++;
for(int j=0;j<len;j+=i) {
ll w=1;
for(int k=j;k<j+(i>>1);k++) {
ll u=A[k],t=w*A[k+(i>>1)]%p;
A[k]=(u+t)%p;A[k+(i>>1)]=(u-t+p)%p;
(w*=wn[c])%=p;
}
}
}
if(tp<0) {
rep(i,1,len/2-1) swap(A[i],A[len-i]);
ll inv=pow(len,p-2);
rep(i,0,len-1) (A[i]*=inv)%=p;
}
}
int check(int g,int m) {
for(int i=2;i*i<m;i++) if((m-1)%i==0&&(pow(g,i,m)==1||pow(g,(m-1)/i,m)==1)) return 0;
return 1;
}
int n,m,X,S,len,gs=2,c[maxn];
ll D[maxn];
void mul(ll* A,ll* B) {
rep(i,0,len-1) D[i]=B[i];
NTT(A,len,1);NTT(D,len,1);
rep(i,0,len-1) (A[i]*=D[i])%=p;
NTT(A,len,-1);
dwn(i,len-1,m-1) (A[i-m+1]+=A[i])%=p,A[i]=0;
}
ll A[maxn],B[maxn];
int main() {
rep(i,0,NUM-1) wn[i]=pow(G,(p-1)/(1<<i));
n=read();m=read();X=read();S=read();
len=1;while(len<=(m<<1)) len<<=1;
while(!check(gs,m)) gs++;
int m0=1;c[1]=0;
rep(i,1,m-2) (m0*=gs)%=m,c[m0]=i;
rep(i,1,S) {
int x=read()%m;
if(x) A[c[x]]=1;
}
B[0]=1;
for(;n;mul(A,A),n>>=1) if(n&1) mul(B,A);
printf("%lld\n",B[c[X]]);
return 0;
}