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