#include using namespace std; long long gcd(long long a,long long b) { if(a % b == 0) { return b; } else { return gcd(b,a % b); } } long long dp[2005][5005]; constexpr int mod = 1000000007; int main() { int N,K; cin >> N >> K; vectortmp; for(int i = 1; i*i <= K; i++) { if(K%i == 0) { tmp.push_back(i); if(i*i != K) { tmp.push_back(K/i); } } } sort(tmp.begin(),tmp.end()); dp[0][tmp.size()-1] = 1; for(int i = 0; i < N; i++) { long long A; cin >> A; for(int j = 0; j < tmp.size(); j++) { long long nxt = tmp[j]/gcd(A,tmp[j]); int it = lower_bound(tmp.begin(),tmp.end(),nxt)-tmp.begin(); dp[i+1][j] += dp[i][j]; dp[i+1][j] %= mod; dp[i+1][it] += dp[i][j]; dp[i+1][it] %= mod; } } if(K == 1) { dp[N][0]--; } cout << dp[N][0] << endl; }