import collections import math N,K = map(int,input().split()) A = list(map(int,input().split())) mod = 10**9+7 for i in range(N): A[i] = math.gcd(A[i],K) DP = collections.defaultdict(int) DP[1]=1 for a in A: NDP = collections.defaultdict(int) CDP = DP.copy() for k,v in CDP.items(): gcd = math.gcd(K,a*k) NDP[gcd]=(NDP[gcd]+DP[k])%mod for k,v in CDP.items(): NDP[k]=(NDP[k]+DP[k])%mod DP = NDP print(DP[K])