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