#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<int> v;
  vector<int> s;
  v.resize(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    if ((v[i] % k == 0 && !(binary_search(s.begin(), s.end(), v[i] / k))) ||
        v[i] % k != 0)
      s.push_back(v[i]);
  }
  cout << s.size() << endl;
  return 0;
}
