#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = 10000000;
int arr[100005];
map<int, int> mm;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (n); i++) {
    cin >> arr[i];
    mm[arr[i]] = 1;
  }
  sort(arr, arr + n);
  int ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (mm[arr[i]] == 0) continue;
    if (arr[i] % k != 0) {
      ans++;
      continue;
    }
    if (mm.find(arr[i] / k) != mm.end()) mm[arr[i] / k] = 0;
    ans++;
  }
  cout << ans << endl;
  return 0;
}
