#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int arr[maxn];
map<int, int> ma;
int main() {
  int n, k;
  int ans = 0;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    if (arr[i] % k || !ma[arr[i] / k]) {
      ma[arr[i]] = ++ans;
    }
  }
  printf("%d\n", ans);
  return 0;
}
