#include <bits/stdc++.h>
using namespace std;
long long n, k, a[100001], res, i;
map<long long, long long> was;
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i], was[a[i]] = 1;
  sort(a + 1, a + n + 1);
  res = n;
  if (k != 1)
    for (i = 1; i <= n; i++)
      if (was[a[i] * k] == 1 && was[a[i]] == 1) res--, was[a[i] * k] = 0;
  cout << res;
  return 0;
}
