#include <bits/stdc++.h>
int n, m;
int a[100001];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int num = 0;
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = i; i < n; j++) {
      sum += a[j];
      if (sum % m == 0) num++;
    }
  }
  std::cout << num << '\n';
}
