#include <bits/stdc++.h>
using namespace std;
long long int v[112345];
bool valid[112345];
int main() {
  int n, k, ans = 0;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; ++i) scanf("%I64d", v + i);
  if (k == 1) {
    printf("%d\n", n);
    return 0;
  }
  sort(v, v + n);
  for (int i = 0, p; i < n; ++i) {
    if (valid[i]) continue;
    p = (int)(lower_bound(v + i, v + n, v[i] * (long long int)k) - v);
    if (p != i && p < n && v[i] * (long long int)k == v[p]) valid[p] = 1;
    ++ans;
  }
  printf("%d\n", ans);
}
