#include <bits/stdc++.h>
using namespace std;
int main() {
  int tmp;
  int i = 0;
  int box = 0;
  int base = 0;
  vector<int> boxes;
  vector<int>::iterator itr;
  cin >> box >> base;
  for (int j = 0; j < box; ++j) {
    cin >> tmp;
    boxes.emplace_back(tmp % base);
  }
  for (int j = 0; j < box; ++j) {
    tmp = 0;
    itr = boxes.begin();
    itr += j;
    for (; itr != boxes.end(); ++itr) {
      tmp = (tmp + *itr) % base;
      if (tmp == 0) {
        ++i;
      }
    }
  }
  cout << i << endl;
  return 0;
}
