#include <bits/stdc++.h>
int main(int argc, char** argv) {
  std::size_t n;
  std::size_t m;
  std::cin >> n;
  std::cin >> m;
  std::vector<std::size_t> a_vec(n);
  for (auto iter = a_vec.begin(); iter < a_vec.end(); ++iter) {
    std::cin >> *iter;
  }
  unsigned long long answer{0};
  for (std::size_t l{0}; l < n; ++l) {
    std::size_t numSnacks{0};
    for (std::size_t r{l}; r < n; ++r) {
      numSnacks += a_vec[r];
      if ((numSnacks % m) == 0) {
        ++answer;
      }
    }
  }
  std::cout << answer << std::endl;
  return 0;
}
