#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);
}
template <class T>
T mod_pow(T x, T n) {
  T res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    n >>= 1;
  }
  return res;
}
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};
int dy[] = {0, 1};
int main(void) {
  int n, m;
  cin >> n >> m;
  ;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long acc_sum[n + 1];
  for (int i = 0; i < n + 1; i++) {
    if (i == 0) {
      acc_sum[0] = 0;
      continue;
    }
    acc_sum[i] = (acc_sum[i - 1] + a[i - 1]) % m;
  }
  vector<long long> partial_sum;
  for (int i = 0; i < n + 1; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      partial_sum.push_back((acc_sum[j] - acc_sum[i] + m) % m);
    }
  }
  sort(((partial_sum)).begin(), ((partial_sum)).end());
  int count = 0;
  for (auto &i : partial_sum) {
    if (i == 0) {
      count++;
    }
  }
  cout << count << '\n';
  return 0;
}
