#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> A(N + 1, 0);
  for (long long i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    A.at(i + 1) = (A.at(i) + a) % M;
  }
  long long ans = 0;
  for (long long i = 0; i < N; ++i) {
    for (long long j = i + 1; j < N + 1; ++j) {
      long long temp = A.at(j) - A.at(i);
      if (temp % M == 0) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}
