#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vll = vector<ll>;
using si = set<int>;
using sll = set<ll>;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vi a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  multiset<int> ms;
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    if (a[i] % k == 0) {
      if (!ms.count(a[i] / k)) ms.insert(a[i]);
    } else {
      ms.insert(a[i]);
    }
  }
  cout << ms.size() << endl;
  return 0;
}
