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