#include <bits/stdc++.h>
int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  int A[N];
  int i;
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int l, r, k = 0, ans = 0;
  for (l = 0; l < N; l++) {
    for (r = l; r < N; r++) {
      k = 0;
      for (i = l; i <= r; i++) {
        k += A[i];
      }
      if (k % M == 0) {
        ans++;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
