from sys import exit from math import gcd from collections import defaultdict mod=10**9+7 n,k=map(int,input().split()) if k==1: print(pow(2,n,mod)-1) exit() A=list(map(lambda x:gcd(int(x),k),input().split())) B=[] cnt=0 for x in A: if x==1: cnt+=1 else: B.append(x) m=len(B) dp=[defaultdict(int) for _ in range(m+1)] dp[0][1]=1 for i in range(1,m+1): for j in dp[i-1]: dp[i][j]+=dp[i-1][j] dp[i][j]%=mod ai=A[i-1] g=gcd(j*ai,k) dp[i][g]+=dp[i-1][j] dp[i][g]%=mod ans=dp[m][k]*pow(2,cnt,mod) print(ans)