#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum[n];
  sum[0] = a[0] % k;
  for (int i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + a[i];
    sum[i] %= k;
  }
  sort(sum, sum + n);
  long long ans = 0;
  long long count = 0;
  long long now = sum[0];
  for (int i = 0; i < n; i++) {
    if (sum[i] == now) {
      count++;
    } else {
      if (now == 0) {
        count++;
      }
      ans = (ans + count * (count - 1) / 2) % mod;
      count = 1;
      now = sum[i];
    }
  }
  if (now == 0) {
    count++;
  }
  ans = (ans + count * (count - 1) / 2) % mod;
  cout << ans << endl;
}
