#include <bits/stdc++.h>
using namespace std;
int main(void) {
  unsigned long n, m;
  cin >> n >> m;
  unsigned long *elems = new unsigned 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++;
  }
  unsigned long sum = 0;
  for (int i = 0; i < n; i++) {
    unsigned long tmp = 0;
    tmp = elems[i];
    if (tmp % m == 0) sum++;
    for (int j = i + 1; j < n; j++) {
      tmp += elems[j];
      if (tmp % m == 0) sum++;
    }
  }
  cout << sum << endl;
}
