# coding: utf-8 # Your code here! import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline read = sys.stdin.read def FastConvolution(A,B): # A,B: 2^c 成分を想定 return ifft(fft(A)*fft(B)) p,n,k,b,*a = [int(i) for i in read().split()] lst = [0]*p for i in range(p): lst[pow(i,k,p)] += 1 MOD = 10**9+7 x = 1 M = 1<<96 NUM = 96*p ALL = (1<>(NUM))+ (x&ALL) x -= ((x & m) >> 30) * pa ans = (x>>(b*96))&((1<<32)-1) print(ans%MOD)