#include <bits/stdc++.h>
using namespace std;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  vector<int> v;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  vector<int> valores;
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    if (v[i] % k != 0) {
      valores.push_back(v[i]);
    } else if (!binary_search(valores.begin(), valores.end(), v[i] / k)) {
      valores.push_back(v[i]);
    }
  }
  cout << valores.size() << endl;
}
