#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 10);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  long ans = 0;
  int check = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      check = (check + a.at(j)) % m;
      if (check % m == 0) {
        ans++;
      }
    }
    check = 0;
  }
  cout << ans << endl;
}
