#ぱっと思いつくのはdp[i][j] = i番目まで見て積をkで割ったあまりがjになるものの個数 無理 #Kの約数で考える? K <= 10^9からもそれっぽい n, k = map(int,input().split()) mod = 10 ** 9 + 7 from collections import Counter import copy a = list(map(int,input().split())) #ありがとう def div(N): ret = [] for i in range(2, N + 1): if i * i > N: break if N % i == 0: ret.append(i) if i != N // i: ret.append(N // i) return ret d = div(k) dp = Counter() for i in d: dp[i] = 0 dp[1] = 1 from math import gcd for i in range(n): E = copy.copy(dp) dp = Counter() for v in E.keys(): dp[gcd(k, v * a[i])] += E[v] dp[v] += E[v] dp[gcd(k, v * a[i])] %= mod dp[v] %= mod print((dp[k] + dp[0] - 1 if k == 1 else 0) % mod)