#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
const long long int mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  long long int t, n, k, p, c, d, x, s = 0, i;
  cin >> n >> k;
  vector<long long int> v;
  set<long long int> ins, del;
  for (long long int i = 0; i < n; i++) {
    cin >> p;
    v.push_back(p);
  }
  sort(v.begin(), v.end());
  for (long long int i = 0; i < n; i++) {
    if (del.find(v[i]) == del.end()) {
      ins.insert(v[i]);
      del.insert(v[i] * k);
    }
  }
  cout << ins.size() << endl;
}
