#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x = 0, ans = 0;
  int i, j, n, m;
  scanf("%d %d", &n, &m);
  long long int* a = new long long int[n];
  for (i = 0; i < n; i++) {
    scanf("%lld", &x);
    a[i] = x % m;
  }
  for (i = 0; i < n; i++) {
    x = a[i];
    for (j = i; j < n - 1; j++) {
      if (x % m == 0) ans++;
      x = (x + a[j + 1]) % m;
    }
    if (x % m == 0) ans++;
  }
  printf("%lld", ans);
  delete[] a;
  return 0;
}
