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