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