#include <bits/stdc++.h>
int main(void) {
  int n, m, a[10000];
  int count;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  count = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      int sum = 0;
      for (int k = i; k <= j; k++) {
        sum += a[k];
        sum %= m;
      }
      if (sum % m == 0) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
