#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  array<int, 100000> v{};
  int n, m;
  ll c = 0;
  cin >> n >> m >> v[0];
  v[0] = v[0] % m;
  for (int i = 1; i < n; ++i) {
    int a;
    scanf("%d", &a);
    v[i] = (v[i - 1] + a) % m;
  }
  for (int i = 0; i < n; ++i) {
    if (!v[i]) c++;
    for (int j = 0; j < i; ++j) {
      if ((!(v[i] - v[j]) % m)) c++;
    }
  }
  cout << c << "\n";
  return 0;
}
