#include <bits/stdc++.h>
using namespace std;
long long n, k, l, p, a[120010], s;
map<long long, long long> mp;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int ss = 0;
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    if (mp[a[i]] == 0) {
      ss++;
      mp[a[i] * k] = 1;
    }
  }
  printf("%d\n", ss);
  return 0;
}
