#include <bits/stdc++.h>
using namespace std;
template <class It>
string join(It i1, It i2) {
  ostringstream ss;
  for (auto it = i1; it != i2; ++it) ss << ((it == i1) ? "" : ", ") << (*it);
  return ss.str();
}
void Print() { cout << endl; }
template <class Head, class... Args>
void Print(Head &&head, Args &&...args) {
  cout << head;
  Print(args...);
}
using ull_t = unsigned long long;
int main() {
  size_t N, M;
  cin >> N >> M;
  vector<ull_t> A(N);
  for (auto &a : A) cin >> a;
  vector<size_t> S(N, 0);
  ull_t out = 0;
  for (size_t w = 0; w < N; ++w) {
    for (size_t i = 0; i + w < N; ++i) {
      S[i] += A[i + w];
      S[i] %= M;
      if (S[i] == 0) ++out;
    }
  }
  cout << out << endl;
}
