#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k;
  cin >> n >> k;
  vector<long long> arr;
  set<long long> s;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    arr.push_back(x);
    s.insert(x);
  }
  vector<pair<long long, long long>> v;
  sort(arr.begin(), arr.end());
  long long ans = 0;
  for (long long i = 1; i < arr.size(); i++) {
    if (arr[i] % k == 0 and k != 1) {
      long long f = arr[i] / k;
      set<long long>::iterator it;
      it = s.find(f);
      if (it != s.end()) {
        it = s.find(arr[i]);
        s.erase(it);
      }
    }
  }
  cout << s.size() << endl;
}
