#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 10;
int n, k, x, ans;
int a[N];
map<int, int> b;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  std::sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
    x = a[i];
    if (x % k | !b[x / k]) b[x] = ++ans;
  }
  printf("%d\n", ans);
  return 0;
}
