#include <bits/stdc++.h>
using namespace std;
set<long long> s;
int niz[100005];
int n, k;
int main(void) {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &niz[i]);
  sort(niz, niz + n);
  int ukupno = 0;
  for (int i = n - 1; i >= 0; i--)
    if (s.find((long long)niz[i] * k) == s.end()) s.insert((long long)niz[i]);
  printf("%d\n", (int)s.size());
  return 0;
}
