#include <bits/stdc++.h>
int N, M, A[100005];
int main() {
  std::cin >> N >> M;
  for (int i = 0; i < N; ++i) std::cin >> A[i];
  long long ans = 0;
  long long sum;
  for (int start = 0; start < N; ++start) {
    sum = 0;
    for (int end = start; end < N; ++end) {
      sum += A[end];
      if (sum % M == 0) ++ans;
    }
  }
  std::cout << ans << '\n';
  return 0;
}
