#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<unsigned long> v;
  for (int i = 0; i < n; i++) {
    unsigned long a;
    cin >> a;
    v.push_back(a);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      unsigned long sum = 0;
      for (int k = i; k <= j; k++) {
        sum += v[k];
      }
      if (sum > 0 && sum % m == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
