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