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