#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long sum;
  int count = 0;
  for (int i = 0; i < N; i++) {
    sum = 0;
    for (int j = i; j < N; j++) {
      sum += *(A.begin() + j);
    }
    for (int j = N; j > i; j--) {
      if (j != N) {
        sum -= *(A.begin() + j);
      }
      if (sum < M) {
        break;
      }
      if (sum % M == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
