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