#include <bits/stdc++.h>
char s[100];
long long a[100005];
int main() {
  int n;
  long long m, ans = 0;
  memset(a, 0, sizeof(a));
  scanf("%d%lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (a[i] % m == 0) ans++;
    a[i] += a[i - 1];
  }
  for (int i = 0; i <= n; i++)
    for (int j = i + 2; j <= n; j++)
      if ((a[j] - a[i]) % m == 0) ans++;
  printf("%lld\n", ans);
  return 0;
}
