import sys input = sys.stdin.readline from collections import * 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)) divs = [] for d in range(1, int(K**0.5)+1): if K%d==0: divs.append(d) if d!=K//d: divs.append(K//d) divs.sort() idx = defaultdict(int) for i in range(len(divs)): idx[divs[i]] = i M = len(idx.keys()) dp = [0]*M dp[0] = 1 for i in range(N): ndp = [0]*M for j in range(M): ndp[j] += dp[j] ndp[j] %= MOD if divs[j]*A[i]%K==0: nj = M-1 else: nj = idx[gcd(K, divs[j]*A[i])] ndp[nj] += dp[j] ndp[nj] %= MOD dp = ndp print(dp[-1])