#include <bits/stdc++.h>
using namespace std;
bool prime(int n) {
  if (n == 2 or n == 3)
    return true;
  else if (n == 1)
    return false;
  else if (n % 2 == 0 or n % 3 == 0)
    return false;
  else {
    for (int i = 5; i * i <= n; i += 6) {
      if (n % i == 0 or n % (i + 2) == 0) return false;
    }
    return true;
  }
}
int main() {
  long long n, k;
  cin >> n >> k;
  set<long long> s, sp, seta;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] % k != 0 and seta.count(arr[i]) == 0)
      s.insert(arr[i]);
    else if (s.count(arr[i] / k) == 0)
      s.insert(arr[i]);
  }
  cout << s.size();
  return 0;
}
