#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, cnt = 0, m, x;
  long long sum = 0;
  unsigned long long s = 0;
  vector<unsigned long long> v;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      s += (v[j] % m);
      s = s % m;
      v.push_back(s);
    }
    s = 0;
  }
  for (i = n; i < v.size(); i++) {
    if (v[i] % m == 0) cnt++;
  }
  cout << cnt << "\n";
  return 0;
}
