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