#include <bits/stdc++.h>
using namespace std;
long long arr[100000 + 5];
bool flag[100000 + 5];
int main() {
  long long n, k;
  scanf("%I64d %I64d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &arr[i]);
  }
  sort(arr, arr + n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (flag[i]) continue;
    long long high = k * arr[i];
    int indx = lower_bound(arr, arr + n, high) - arr;
    long long ans = arr[indx];
    if (high == ans) {
      flag[indx] = true;
    }
    cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}
