#include <bits/stdc++.h>
using namespace std;
template <typename T>
T fastPower(T base, T power) {
  if (!power) return 1;
  T ans = fastPower(base, power / 2);
  return power & 1 ? ans * ans * base : ans * ans;
}
int n, k, arr[100005];
bool vis[100005];
int BS(int start, int end, long long target) {
  if (start > end) return -1;
  int mid = start + (end - start) / 2;
  if (arr[mid] == target) return mid;
  return (arr[mid] < target) ? BS(mid + 1, end, target)
                             : BS(start, mid - 1, target);
}
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) scanf("%d", arr + i);
  sort(arr, arr + n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int idx = BS(0, n - 1, (long long)k * arr[i]);
    if (!vis[i]) {
      ++ans;
      if (idx != -1) vis[idx] = true;
    }
  }
  cout << ans;
  return 0;
}
