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 = {k: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(): nex = x for i in range(l): for j in range(cand[i]): if nex%div[i] == 0: nex //= div[i] else: break ndic[nex] = (ndic.get(nex,0)+v)%mod ndic[x] = (ndic.get(x,0)+v)%mod dic = ndic print(dic.get(1,0))