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