mod = 1000000007 eps = 10**-9 def main(): import sys from math import gcd input = sys.stdin.readline N, K = map(int, input().split()) A = list(map(int, input().split())) div = [] for d in range(1, K+1): if d * d > K: break if K % d == 0: div.append(d) div.append(K // d) if div[-1] == div[-2]: div.pop() dp = {} dp[1] = 1 for a in A: dp_new = {} for j in dp: if j not in dp_new: dp_new[j] = 0 dp_new[j] = (dp_new[j] + dp[j])%mod j_new = gcd(j * a, K) if j_new not in dp_new: dp_new[j_new] = 0 dp_new[j_new] = (dp_new[j_new] + dp[j])%mod dp = dp_new if K not in dp: dp[K] = 0 print(dp[K]) if __name__ == '__main__': main()