#include #define rep(i,n) for(int i = 0; i < (int)(n); i++) using namespace std; using LL = long long; using P = pair; using vv = vector>; const int INF = (int)1e9; const LL LINF = (LL)1e18; long long const mod = 1000000007; struct mint{ long long val; mint(long long val = 0): val(val % mod) {} mint& operator += (const mint n){ val += n.val; if(val >= mod) val -= mod; return *this; } mint& operator -= (const mint n){ val -= n.val; if(val < 0) val += mod; return *this; } mint& operator *= (const mint n){ val *= n.val; val %= mod; if(val < 0) val += mod; return *this; } mint operator + (const mint n) const{ mint res(*this); return res += n; } mint operator - (const mint n) const{ mint res(*this); return res -= n; } mint operator * (const mint n) const{ mint res(*this); return res *= n; } mint pow(long long n) const{ if(n == 0) return 1; mint m = pow(n >> 1); m *= m; if(n & 1) m *= *this; return m; } // mint division for prime mod mint inv() const{ return pow(mod - 2); } mint& operator /= (const mint n){ return (*this) *= n.inv(); } mint operator / (const mint n) const{ mint res(*this); return res /= n; } }; int main(){ int N; LL K; cin >> N >> K; vector A(N); rep(i,N) cin >> A[i]; vector> dp(N+1); dp[0][K] = 1; rep(i,N){ for(auto itr : dp[i]){ LL res = itr.first; mint cnt = itr.second; dp[i+1][res] += cnt; LL g = gcd(res, A[i]); dp[i+1][res / g] += cnt; } } cout << dp[N][1].val << endl; return 0; }