#include <bits/stdc++.h>
using namespace std;
struct Fast {
  Fast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
signed main(void) {
  long long num;
  num = 0;
  long long N;
  long long M;
  array<long long, 100000> A;
  cin >> N >> M;
  for (auto it = A.begin(); it < A.begin() + N; ++it) {
    cin >> *it;
    *it = *it % M;
  }
  for (long long i = 0; i < N; ++i) {
    long long tmp = A[i];
    if (tmp == 0) ++num;
    for (long long j = i + 1; j < N; ++j) {
      if (A[j] == 0)
        ++num;
      else {
        tmp += A[j];
        tmp %= M;
        if (tmp == 0) ++num;
      }
    }
  }
  cout << num << endl;
  return 0;
}
