n,k = map(int,input().split()) A = list(map(int,input().split())) mod = 10**9+7 if k == 1: print((pow(2,n,mod)-1)%mod) exit() div = [] dnum = [] num = k for i in range(2,int(k**0.5)+1): if num%i: continue count = 0 while num%i == 0: num //= i count += 1 div.append(i) dnum.append(count) if num != 1: div.append(num) dnum.append(1) l = len(div) dic = {1:1} for a in A: cand = [0]*l for i,d in enumerate(div): while a%d == 0: a //= d cand[i] += 1 ndic = {} for x,v in dic.items(): num = x cand2 = [0]*l for i,d in enumerate(div): while num%d == 0: num //= d cand2[i] += 1 nex = 1 for i,d in enumerate(div): if cand[i]+cand2[i] > dnum[i]: nex *= pow(d,dnum[i]) else: nex *= pow(d,cand[i]+cand2[i]) ndic[nex] = (ndic.get(nex,0)+v)%mod ndic[x] = (ndic.get(x,0)+v)%mod dic = ndic print(dic.get(k,0))