#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0);
const long long mod = 4294967296;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  long long cnt = 0;
  map<long long, long long> make_pair;
  for (int i = n - 1; i >= 0; i--) {
    long long x = a[i] * k;
    if (!make_pair[x]) {
      cnt++;
      make_pair[a[i]] = 1;
    }
  }
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int q = 1;
  while (q--) {
    solve();
  }
  return 0;
}
