#include <bits/stdc++.h>
using namespace std;
int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);
int main() {
  long n, m;
  cin >> n >> m;
  vector<long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long count = 0;
  vector<long> cs(n + 1);
  cs[0] = 0;
  for (int i = 1; i <= n; i++) {
    cs[i] = cs[i - 1] + a[i - 1];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      if ((cs[i] - cs[j]) % m == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
int sum_digits(int num) {
  int rtn = 0;
  while (num != 0) {
    int tmp = num % 10;
    rtn += tmp;
    num /= 10;
  }
  return rtn;
}
template <class T>
vector<T> copy_vector(vector<T> vec) {
  vector<T> rtn;
  rtn.reserve(vec.size());
  copy(vec.begin(), vec.end(), back_inserter(rtn));
  return rtn;
}
