#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
const double pi = 3.14159265358979323;
const double eps = 1e-8;
int n, k, a[100100];
set<long long> vis;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); i++) scanf("%d", &a[i]);
  sort(a, a + n);
  int ans = 0;
  for (int i = (0); i < (n); i++) {
    if (vis.find(a[i]) == vis.end()) {
      ans++;
      vis.insert(1LL * a[i] * k);
    } else
      continue;
  }
  printf("%d\n", ans);
  return 0;
}
