#include <bits/stdc++.h>
using namespace std;
int comp(const void* x, const void* y) { return *(int*)x - *(int*)y; }
int a[100007];
int bad[100007];
bool used[100007];
int main() {
  int i;
  int n, k;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) used[i] = false;
  if (k == 1) {
    cout << n;
    return 0;
  }
  qsort(a, n, sizeof(int), comp);
  int p1, p2 = 0;
  int kf = 0;
  for (p1 = 0; p1 < n; p1++) {
    while (p2 != n && (long long)a[p2] < (long long)a[p1] * (long long)k) p2++;
    bad[p1] = -1;
    if (p2 != n && (long long)a[p2] == (long long)k * (long long)a[p1])
      bad[p1] = p2;
  }
  int toDel = 0;
  for (i = 0; i < n; i++)
    if (!used[i]) {
      int cc = 1;
      int j = i;
      used[i] = true;
      while (bad[j] != -1) {
        j = bad[j];
        cc++;
        used[j] = true;
      }
      toDel += cc / 2;
    }
  cout << n - toDel;
}
