#include <bits/stdc++.h>
using namespace std;
int main() {
  uint64_t n, m;
  cin >> n >> m;
  vector<uint64_t> v;
  v.push_back(0);
  for (uint64_t i = 0; i < n; i++) {
    uint64_t x;
    cin >> x;
    v.push_back(x);
  }
  for (uint64_t i = 1; i < v.size(); i++) {
    v[i] += v[i - 1];
  }
  uint64_t tot = 0;
  for (int l = 1; l < v.size(); l++) {
    for (int r = l; r < v.size(); ++r) {
      uint64_t sum = v[r] - v[l - 1];
      if (sum % m == 0) {
        tot++;
      }
    }
  }
  cout << tot;
  return 0;
}
