#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
using namespace std;
using ll = long long int;
using P = pair<int, int>;
using edge = struct {
  int to;
  int cost;
};
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
template <typename T, typename U>
U read(ll V, T a, U b) {
  for (ll i = 0; i < (V); i++) {
    cin >> a;
    b.push_back(a);
  }
  return b;
}
int main() {
  ll N, M, C = 0;
  vector<ll> A;
  A.push_back(0);
  cin >> N >> M;
  for (ll i = 0; i < (N); i++) {
    ll po;
    cin >> po;
    A.push_back((A.back() + po) % M);
  }
  for (ll i = 0; i < (N); i++)
    for (int j = (i + 1); j < (N + 1); ++j) {
      if ((A[i] - A[j]) % M == 0) C++;
    }
  cout << C << endl;
  return 0;
}
