#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const* argv[]) {
  int n, m;
  cin >> n >> m;
  auto as = vector<int>(n);
  for (auto&& a : as) {
    cin >> a;
  }
  uint64_t res = 0;
  uint64_t curr = 0;
  for (int i = 0; i < as.size(); ++i) {
    curr += as[i];
    uint64_t temp = 0;
    for (int j = i; j < as.size(); ++j) {
      curr += as[j];
      temp += as[j];
      if ((curr % m) == 0) {
        res++;
      }
    }
    curr -= temp;
  }
  cout << res << endl;
}
