MOD = 10**9 + 7 def main(): import sys input = sys.stdin.read data = input().split() idx = 0 p = int(data[idx]); idx +=1 n = int(data[idx]); idx +=1 k = int(data[idx]); idx +=1 b = int(data[idx]); idx +=1 a = list(map(int, data[idx:idx+n])) idx +=n m = 0 variables = [] for ai in a: if ai == 0: m +=1 else: variables.append(ai) dp = [0] * p dp[0] = 1 for ai in variables: cnt = [0] * p for x in range(p): x_pow = pow(x, k, p) c = (ai * x_pow) % p cnt[c] += 1 new_dp = [0] * p for s in range(p): if dp[s] == 0: continue for c in range(p): if cnt[c] == 0: continue new_s = (s + c) % p new_dp[new_s] = (new_dp[new_s] + dp[s] * cnt[c]) % MOD dp = new_dp total = dp[b] * pow(p, m, MOD) % MOD print(total) if __name__ == '__main__': main()