#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  int64_t M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int64_t ans = 0;
  for (int l = 0; l < N; l++) {
    vector<int64_t> p(N - l);
    p[l] = A[l];
    for (int r = l + 1; r < N; r++) {
      p[r] = p[r - 1] + A[r];
    }
    for (int r = l; r < N; r++) {
      if (p[r] % M == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
