MOD = 10 ** 9 + 7 n, k = map(int, input().split()) a = list(map(int, input().split())) dp = {} dp[1] = 1 for i in range(n): ndp = {} for x, v in dp.items(): ndp[x] = (ndp.get(x, 0) + v) % MOD nxt = (x * a[i]) % k ndp[nxt] = (ndp.get(nxt, 0) + v) % MOD dp = ndp print(dp[0])