#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, i, M, temp, ans = 0, l, r;
  cin >> N >> M;
  vector<long> A;
  for (i = 0; i < N; i++) {
    cin >> temp;
    A.push_back(temp);
  }
  for (l = 0; l < N - 1; l++) {
    temp = 0;
    for (r = l; r < N; r++) {
      temp += A.at(r);
      if (temp % M == 0) {
        ans++;
      }
    }
  }
  cout << ans;
  return 0;
}
