#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn * 4];
int arr[maxn];
int ans;
int n, m;
void build(int rt, int l, int r) {
  if (l == r) {
    a[rt] = arr[l];
    ;
    if (a[rt] % m == 0) ++ans;
    return;
  }
  int m = l + (r - l) / 2;
  build(rt << 1, l, m);
  build(rt << 1 | 1, m + 1, r);
  a[rt] = a[rt << 1] + a[rt << 1 | 1];
  if (a[rt] % m == 0) ++ans;
  ;
  ;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &arr[i]);
  }
  build(1, 1, n);
  printf("%d\n", ans);
  return 0;
}
