#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  long long j = 0, cnt = 0;
  vector<bool> ch(n, true);
  for (long long i = 0; i < n; i++) {
    if (ch[i]) {
      j = lower_bound(a.begin(), a.end(), k * a[i]) - a.begin();
      if (j >= n) break;
      if (a[j] == k * a[i]) {
        ch[j] = false;
        cnt++;
      }
    }
  }
  cout << (n - cnt) << endl;
  return 0;
}
