#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, cnt = 0;
  cin >> n >> k;
  vector<long long> vec(n);
  map<long long, bool> sol;
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
    sol.insert(make_pair(vec[i], 1));
  }
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; ++i) {
    if (sol.find(vec[i] * k) != sol.end()) {
      if (sol[vec[i]] == 1 and sol[vec[i] * k] == 1) sol[vec[i] * k] = 0;
    }
  }
  for (auto i = sol.begin(); i != sol.end(); ++i)
    if (i->second == 1) ++cnt;
  cout << cnt << "\n";
  return 0;
}
