#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
int main() {
  std::ios_base::sync_with_stdio(0);
  int ct = 0, n, k, nm, val;
  cin >> n >> k;
  ct = 0;
  vector<int> v;
  int vis[n + 11];
  memset(vis, 0, sizeof vis);
  for (int i = 0; i < n; ++i) {
    cin >> nm;
    v.push_back(nm);
  }
  sort(v.begin(), v.end());
  for (int i = int((v).size()) - 1; i >= 0; --i) {
    if (!vis[i]) {
      if (v[i] % k == 0) {
        if (binary_search((v).begin(), (v).end(), v[i] / k)) {
          int indx = lower_bound(v.begin(), v.end(), v[i] / k) - v.begin();
          vis[indx] = 1;
        }
      }
      ct++;
    }
  }
  cout << ct << endl;
  return 0;
}
