#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod(ll n, ll r) {
  ll q = n % r;
  return (q < 0) ? q + r : q;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  vector<ll> list(n + 1);
  list[0] = 0;
  for (int i = (int)(0); i < (int)(n); ++i) {
    cin >> a[i];
    list[i + 1] = list[i] + a[i];
    list[i + 1] = mod(move(list[i + 1]), m);
  }
  ll count = 0;
  for (int l = (int)(0); l < (int)(n); ++l) {
    for (int r = (int)(l + 1); r < (int)(n + 1); ++r) {
      if (mod(list[r] - list[l], m) == 0) {
        ++count;
      }
    }
  }
  cout << count << endl;
}
