from collections import defaultdict MOD = 10 ** 9 + 7 n, k = map(int, input().split()) a = list(map(int, input().split())) if k == 1: print((pow(2, n, MOD) - 1) % MOD) exit() dp = defaultdict(int) dp[1] = 1 for i in range(n): ndp = defaultdict(int) for x, v in dp.items(): ndp[x] = (ndp[x] + v) % MOD nx = (x * a[i]) % k ndp[nx] = (ndp[nx] + v) % MOD dp = ndp print(dp[0])