#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  long long M;
  cin >> N >> M;
  long long A[100001] = {};
  A[0] = 0;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (int i = 1; i <= N; i++) {
    A[i] += A[i - 1];
    A[i] %= M;
  }
  sort(A, A + N + 1);
  long long ans = 0;
  long long cnt = 1;
  for (int i = 1; i <= N; i++) {
    if (A[i] == A[i - 1]) {
      cnt++;
    } else {
      ans += (((cnt * (cnt - 1)) % 1000000007) / 2) % 1000000007;
      ans %= 1000000007;
      cnt = 1;
    }
  }
  ans += (((cnt * (cnt - 1)) % 1000000007) / 2) % 1000000007;
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
