import collections import math N,K = map(int,input().split()) A = list(map(int,input().split())) mod = 10**9+7 for i in range(N): A[i] = math.gcd(A[i],K) DP = collections.defaultdict(int) DP[1]=1 for a in A: NDP = collections.defaultdict(int) CDP = DP.copy() for k,v in CDP.items(): gcd = math.gcd(K,a*k) NDP[gcd]=(NDP[gcd]+DP[k])%mod NDP[k]=(NDP[k]+DP[k])%mod DP = NDP if K==1: DP[K]=(DP[K]-1)%mod print(DP[K])