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())) d=defaultdict(int) d[1]=1 cnt=0 B=[] for x in A: if x==1: cnt+=1 else: B.append(x) for i in B: d2=d.copy() for j in d2: m=gcd(k,i*j) d[m]=(d2[j]+d[m])%mod print(d[k]*pow(2,cnt,mod)%mod)