#include using namespace std; using ll = long long; #define rep(i, n) for (int i=0; i<(int)(n); ++(i)) #define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i)) #define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i)) #define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i)) #define all(x) (x).begin(), (x).end() // const ll mod = (ll)(1e9) + 7; int main() { int n, k; cin >> n >> k; vector a(n); rep(i, n) cin >> a[i]; if (k == 1) { ll res = 1; rep(i, n) res = res * 2 % mod; res = (res - 1 + mod) % mod; cout << res << endl; return 0; } unordered_set kprimes; for (int i=1; i*i<=k; ++i) if (k%i == 0) { kprimes.insert(i); kprimes.insert(k/i); } unordered_map dp; for (int pval : kprimes) dp[pval] = 0; rep(i, n) { auto ndp = dp; for (auto pi : ndp) dp[(int)((ll)pi.first*(a[i]%k)%k)] = (dp[(int)((ll)pi.first*(a[i]%k)%k)] + pi.second) % mod; dp[(int)(a[i]%k)] = (dp[(int)(a[i]%k)] + 1) % mod; } cout << dp[0] << endl; return 0; }