#include <bits/stdc++.h>
std::vector<int> a;
long sumOfRange(int l, int r) {
  long res = 0;
  for (int i = l; i < r; ++i) {
    res += a[i];
  }
  return res;
}
int main() {
  int n, m;
  std::cin >> n >> m;
  a.reserve(n);
  for (int i = 0; i < n; ++i) {
    int tmp;
    std::cin >> tmp;
    a.push_back(tmp);
  }
  int count = 0;
  for (int l = 0; l < n; ++l) {
    for (int r = l + 1; r <= n; ++r) {
      long sum = sumOfRange(l, r);
      if (sum % m == 0) {
        ++count;
      }
    }
  }
  std::cout << count << std::endl;
}
