#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[100000];
map<int, bool> check;
int main() {
  scanf("%d", &n);
  scanf("%d", &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (check[a[i]]) continue;
    ans++;
    if (1LL * a[i] * k <= 1e9) check[a[i] * k] = 1;
  }
  printf("%d\n", ans);
  return 0;
}
