#include <bits/stdc++.h>
using namespace std;
int n, i, tot, now, cc;
long long k;
bool f[100005];
long long a[100005];
int main() {
  scanf("%d%I64d", &n, &k);
  for (i = 0; i < n; i++) scanf("%I64d", &a[i]);
  memset(f, 1, sizeof(f));
  sort(a, a + n);
  int ans = 0;
  for (i = 0; i < n; i++) {
    if (f[i] == 0) continue;
    now = i;
    tot = 1;
    while (1) {
      int cc = lower_bound(a + now + 1, a + n, a[now] * k) - a;
      if (a[cc] == a[now] * k) {
        tot++;
        f[cc] = 0;
      } else
        break;
      now = cc;
    }
    ans += (tot + 1) / 2;
  }
  printf("%d\n", ans);
}
