#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  set<long long> s;
  for (auto& i : a) cin >> i, s.insert(i);
  if (k == 1) return cout << n, 0;
  sort((a).begin(), (a).end());
  for (auto i : a)
    if (s.find(i) != s.end() && s.find(i * k) != s.end()) s.erase(i * k);
  cout << s.size();
}
