import math def make_divisors(n): ans = [] for i in range(1, n+1): if i*i > n: break if n % i == 0: ans.append(i) if i != n // i: ans.append(n//i) return sorted(ans) n, k = map(int, input().split()) a = list(map(int, input().split())) mod = 10**9+7 divs = make_divisors(k) dp = {} for key in divs: dp[key] = 0 dp[1] += 1 for i in range(n): dp_copy = dp.copy() for key in divs: to = math.gcd(k, a[i]*key) dp[to] += dp_copy[key] dp[to] %= mod if k == 1: print((dp[k]-1)%mod) else: print(dp[k]%mod)