#include <bits/stdc++.h>
using namespace std;
constexpr int kMod = 1000000007;
template <typename T>
istream& operator>>(istream& is, vector<T>& vs) {
  for (T& v : vs) is >> v;
  return is;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<long long> A(N);
  cin >> A;
  vector<long long> S(N + 1);
  S[0] = 0;
  for (int i = 0; i < N; ++i) S[i + 1] = S[i] + A[i];
  long long cnt = 0;
  for (int l = 0; l <= N; ++l) {
    for (int r = l + 1; r <= N; ++r) {
      if ((S[r] - S[l]) % M == 0) ++cnt;
    }
  }
  cout << cnt << endl;
}
