from collections import defaultdict def prime_factorization(n): arr = defaultdict(int) for i in range(2, int(n**0.5)+1): while n % i == 0: arr[i] += 1 n //= i if n != 1: arr[n] += 1 return arr def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def k_divisors(n): ans = defaultdict(int) for k in divmax: while n % k == 0: n //= k ans[k] += 1 return ans n, k = map(int, input().split()) a = list(map(int, input().split())) mod = 10**9+7 divs = {} dp = {} for mm in make_divisors(k): divs[mm] = prime_factorization(mm) dp[mm] = 0 divmax = divs[k] dp[1] += 1 for i in range(n): divai = k_divisors(a[i]) dp_copy = dp.copy() for fr, div in divs.items(): to = 1 for key in divmax: to *= pow(key, min(divmax[key], div[key]+divai[key])) dp[to] += dp_copy[fr] dp[to] %= mod if k == 1: print((dp[k]-1)%mod) else: print(dp[k]%mod)