#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long int gcd(long int a, long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
string converter(T n) {
  stringstream x;
  x << n;
  return x.str();
}
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int main(void) {
  int n, m;
  cin >> n >> m;
  ;
  long int a[n];
  long int sum[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (i == 0)
      sum[i] = a[i] % m;
    else
      sum[i] = (sum[i - 1] + a[i]) % m;
  }
  sort(sum, sum + n);
  int count = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      long int _sum = 0;
      if (i == 0)
        _sum = sum[j];
      else
        _sum = sum[j] - sum[i - 1];
      if (_sum % m == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
