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