#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 9;
long long a[maxn];
bool flag[maxn];
int n, k, i, j;
int l, r, mid;
int x;
int ans;
int find() {
  l = i + 1;
  r = n;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (a[mid] < k * a[i])
      l = mid + 1;
    else if (a[mid] > k * a[i])
      r = mid - 1;
    else
      return mid;
  }
  return -1;
}
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) scanf("%lld", a + i);
  sort(a + 1, a + 1 + n);
  memset(flag, false, sizeof(flag));
  ans = n;
  for (i = 1; i <= n; i++) {
    if (!flag[i]) {
      x = find();
      if (x != -1) {
        flag[x] = true;
        ans--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
