#include <bits/stdc++.h>
long long A[100000];
unsigned char B[100000];
long N, K;
void swap(long long *a, long long *b) {
  long tmp = *a;
  *a = *b;
  *b = tmp;
}
long partition(long long A[], long low, long up) {
  long x = A[low], i = low - 1, j = up + 1;
  while (1) {
    do
      ;
    while (A[++i] < x);
    do
      ;
    while (A[--j] > x);
    if (i < j)
      swap(A + i, A + j);
    else
      return (j);
  }
}
void quicksort(long long A[], long low, long up) {
  long q, pos;
  if (low >= up) return;
  pos = (up + low) / 2;
  swap(A + low, A + pos);
  q = partition(A, low, up);
  quicksort(A, low, q);
  quicksort(A, q + 1, up);
}
long binarySearch(long long A[], long long k, long low, long up) {
  long mid;
  while (low <= up) {
    mid = (low + up) / 2;
    if (A[mid] == k)
      return (mid);
    else if (A[mid] > k)
      up = mid - 1;
    else
      low = mid + 1;
  }
  return (-1);
}
int main() {
  long i, pos, cnt = 0L;
  scanf("%ld %ld\n", &N, &K);
  for (i = 0; i < N; i++) {
    scanf("%ld ", (A + i));
    B[i] = 1;
  }
  quicksort(A, 0, N - 1);
  for (i = 0; i < N - 1; i++)
    if (B[i]) {
      pos = binarySearch(A, K * A[i], i + 1, N - 1);
      if (pos > -1) {
        B[pos] = 0;
        fprintf(stderr, "%ld %ld %ld %ld\n", i, A[i], pos, A[pos]);
      }
    }
  for (i = 0; i < N; i++)
    if (B[i]) cnt++;
  printf("%ld\n", cnt);
  return (0);
}
