#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  cin >> m;
  int sumA[100001] = {};
  for (int i = 1; i <= n; i++) {
    cin >> sumA[i];
    if (i > 0) sumA[i] += sumA[i - 1];
    sumA[i] %= m;
  }
  multiset<int> set;
  set.insert(0);
  long ans = 0;
  for (int i = 1; i <= n; i++) {
    auto count = set.count(sumA[i]);
    if (count > 0) {
      ans += count;
    }
    set.insert(sumA[i]);
  }
  cout << ans << endl;
  return 0;
}
