#include <bits/stdc++.h>
using namespace std;
namespace patch {
template <typename T>
std::string to_string(const T& n) {
  std::ostringstream stm;
  stm << n;
  return stm.str();
}
}  // namespace patch
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[n];
  long long b;
  for (int i = 0; i < n; i++) {
    cin >> b;
    a[i] = b % m;
  }
  long long sum;
  long long count = 0;
  long long cumulative_sum[n];
  cumulative_sum[0] = a[0];
  for (int i = 1; i < n; i++) {
    cumulative_sum[i] = cumulative_sum[i - 1] + a[i];
  }
  for (int l = 1; l < n + 1; l++) {
    for (int r = l; r < n + 1; r++) {
      if (l != 1)
        sum = cumulative_sum[r - 1] - cumulative_sum[l - 1 - 1];
      else
        sum = cumulative_sum[r - 1];
      if (sum % m == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
