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