#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> A, B;
int main() {
  int temp;
  cin >> N >> M;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  for (int i = 0; i < N; ++i) {
    int l = 0;
    for (int j = i; j < N; ++j) {
      l += A[j];
      B.push_back(l);
    }
  }
  int count = 0;
  for (int i = 0; i < B.size(); ++i) {
    if (B[i] % M == 0) {
      ++count;
    }
  }
  cout << count << endl;
  return 0;
}
