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