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