#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  set<long long> myset;
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    myset.insert(c);
  }
  auto it = myset.begin();
  int ans = 0;
  do {
    long long x = (*it) * k;
    if (x != *it) {
      if (myset.count(x)) myset.erase(x);
    }
    ans++;
    if (it != myset.end()) it++;
  } while (it != myset.end());
  cout << ans;
}
