def Divisors(N): N=abs(N) L,U=[],[] k=1 while k*k <=N: if N%k== 0: L.append(k) if k*k!=N: U.append(N//k) k+=1 return L+U[::-1] #================================================== from math import gcd N,K=map(int,input().split()) A=list(map(int,input().split())) Mod=10**9+7 if K==1: exit(print((pow(2,N,Mod)-1)%Mod)) D=Divisors(K)[::-1] DP={d:0 for d in D}; DP[1]=1 for a in A: for d in D: DP[gcd(a*d,K)]+=DP[d] for d in D: DP[d]%=Mod print(DP[K])