from collections import defaultdict from math import gcd 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() dp = defaultdict(int) dp[1] = 1 for a in A: a = gcd(K, a) ndp = defaultdict(int) for k in dp: ndp[k] += dp[k] ndp[k] %= MOD ndp[gcd(a*k, K)] += dp[k] ndp[gcd(a*k, K)] %= MOD dp = ndp print(dp[0])