#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using mint=modint1000000007;

int main()
{
    int n;cin>>n;
    ll k;cin>>k;
    if(k==1){
        cout<<(mint(2).pow(n)-1).val()<<endl;
        return 0;
    }
    ll a[2020];
    for(int i=0; i<n; i++){
        cin>>a[i];
        a[i]%=k;
    }
    map<ll, mint> dp;
    dp[1]=1;
    for(int i=0; i<n; i++){
        map<ll, mint> ndp=dp;
        for(auto p:dp){
            ll g=gcd(k, p.first*a[i]%k);
            ndp[g]+=p.second;
        }
        swap(dp, ndp);
    }
    cout<<dp[k].val()<<endl;
    return 0;
}