#include <bits/stdc++.h>
using namespace std;
long long fac[110000], finv[110000], inv[110000];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 110000; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
int main() {
  COMinit();
  int N;
  long long M, A[110000];
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> A[i];
  map<long long, int> V;
  long long sum = 0;
  V[0]++;
  for (int i = 0; i < N; i++) {
    sum += A[i];
    sum %= M;
    V[sum]++;
  }
  long long ans = 0;
  for (auto it = V.begin(); it != V.end(); it++) {
    ans += COM(it->second, 2);
    ans %= 1000000007;
  }
  cout << ans << endl;
}
