#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long N, M;
  long ans = 0;
  cin >> N >> M;
  long A[N];
  for (long i = 0; i < N; i++) cin >> A[i];
  long total = 0;
  for (long i = 0; i < N; i++) total += A[i];
  for (long i = 0; i < N; i++) {
    long tmp = total;
    for (long j = N - 1; tmp != 0; j--) {
      if (tmp % M == 0) ans++;
      tmp -= A[j];
    }
    total -= A[i];
  }
  cout << ans << endl;
  return 0;
}
