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