#include <bits/stdc++.h>
using namespace std;
long long k, val;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  set<long long> s;
  int n;
  cin >> n >> k;
  if (n == 1) {
    cout << "1" << endl;
    return 0;
  }
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> val;
    s.insert(val);
  }
  set<long long>::reverse_iterator it;
  for (it = s.rbegin(); it != s.rend(); it++) {
    if ((*it) % k != 0) continue;
    if (s.find((*it) / k) != s.end()) s.erase((*it) / k);
  }
  cout << s.size() << "\n";
  return 0;
}
