#include <bits/stdc++.h>
using ll = long long;
int main() {
  int N, M;
  std::cin >> N >> M;
  std::vector<int> A(N);
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
  }
  std::vector<ll> sums(N + 1);
  sums[0] = 0;
  for (int i = 1; i < N + 1; i++) {
    sums[i] = sums[i - 1] + A[i - 1];
  }
  ll ans = 0;
  for (int l = 1; l <= N; l++) {
    for (int r = l; r <= N; r++) {
      ll a = sums[r] - sums[l - 1];
      if (a % M == 0) {
        ans++;
      }
    }
  }
  std::cout << ans << std::endl;
}
