N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): while True: r = a % b a = b b = r if r == 0:return a A = [gcd(a,K) for a in A] P = 10 ** 9 + 7 from collections import defaultdict dp = defaultdict(int) dp[1] = 1 for a in A: nx = defaultdict(int) for i in dp: nx[gcd(i * a,K)] += dp[i] for k in dp: nx[k] += dp[k] for k in nx: nx[k] %= P dp = nx print(dp[K])