#include <bits/stdc++.h>
using namespace std;
int arr[100001];
bool binary_search(long long a, long long n) {
  long long l = 0, r = n - 1, w;
  while (l <= r) {
    w = (l + r) / 2;
    if (arr[w] == a && arr[w] >= 0) {
      arr[w] = -1;
      return true;
    } else if (arr[w] > a) {
      r = w - 1;
    } else
      l = w + 1;
  }
  return false;
}
int main() {
  long long count = 0;
  long long n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    if (binary_search(arr[i] * k, n)) {
      arr[i] = -1;
      count++;
    }
  }
  int y = n - (count * 2) >= 0 ? n - (count * 2) : 0;
  cout << count + y << endl;
  return 0;
}
