#include <bits/stdc++.h>
using namespace std;
unsigned long accum(int idx, int end, long *elems, unsigned long tmp, long sum,
                    int m) {
  if (idx >= end) return sum;
  tmp += elems[idx];
  if (tmp % m == 0) {
    sum++;
  }
  return accum(idx + 1, end, elems, tmp, sum, m);
}
int main(void) {
  long n, m;
  cin >> n >> m;
  long *elems = new long[n];
  string s, item;
  getline(cin, s);
  getline(cin, s);
  stringstream ss(s);
  int i = 0;
  while (getline(ss, item, ' ')) {
    if (!item.empty()) {
      elems[i] = strtol(item.c_str(), nullptr, 10);
    }
    i++;
  }
  long sum = 0;
  for (int i = 0; i < n; i++) {
    unsigned long tmp = 0;
    tmp = elems[i];
    if (tmp % m == 0) sum++;
    sum = accum(i + 1, n, elems, tmp, sum, m);
  }
  cout << sum << endl;
}
