#include <bits/stdc++.h>
long long a[100005], b[100000005] = {0};
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  long long x = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n - i + 1; j++) {
      for (int k = i; k <= i + j - 1; k++) {
        b[x] += a[k];
      }
      x++;
    }
  }
  int y = 0;
  for (int i = 0; i < x; i++) {
    if (b[i] % m == 0) y++;
  }
  printf("%d\n", y);
}
