#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010] = {0}, n, k;
int in(int n, int x) {
  if (x < b[0] || x > b[n - 1]) return false;
  int l = 0, r = n - 1, mid;
  if (x == b[r]) return true;
  while (l < r - 1) {
    mid = (l + r) >> 1;
    if (x < b[mid])
      r = mid;
    else
      l = mid;
  }
  if (x == b[l])
    return true;
  else
    return false;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] % k == 0 && (!in(ans, a[i] / k))) b[ans++] = a[i];
    if (a[i] % k != 0) b[ans++] = a[i];
  }
  cout << ans << endl;
  return 0;
}
