#include #include #include #include #include #include #include #include using namespace std; using ll = long long; #define rep(i, j, n) for (int i = j; i < (n); ++i) constexpr int MOD = 1000000007; map dp[2002]; // dp[i][j] := i番目まで選んで、あまりj int main() { cin.tie(0)->sync_with_stdio(0); ll n, k; cin >> n >> k; if(k==1){ ll ii = 1; rep(i,0,n)(ii*=2)%=MOD; cout< a(n); rep(i, 0, n){cin>>a[i];a[i]%=k;} dp[0][1] = 1; rep(i, 0, n) { for (auto &[j, v] : dp[i]) { (dp[i + 1][gcd(j * a[i], k)] += v)%=MOD; (dp[i + 1][j] += v)%=MOD; } } cout << dp[n][k]; return 0; }