#include <bits/stdc++.h>
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
constexpr int MOD = 1000000007;
void print(const std::vector<int>& v) {
  std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
  std::cout << std::endl;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N), S(N + 1, 0);
  for (long long i = 0; i < (long long)N; i++) {
    cin >> A[i];
    A[i] %= M;
    S[i + 1] += A[i] + S[i];
    S[i + 1] %= M;
  }
  long long cnt = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j <= N + 1; j++) {
      if ((S[j] - S[i] % M) == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
