#include <bits/stdc++.h>
int main(void) {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) {
    std::cin >> v[i];
  }
  long int ans = 0;
  int index = 0;
  while (index < n) {
    long int sum = 0;
    int i = index;
    while (i < n) {
      sum += v[i];
      if (sum % m == 0) {
        ans++;
      }
      i++;
    }
    index++;
  }
  std::cout << ans << "\n";
}
