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