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