#include <bits/stdc++.h>
using namespace std;
long long in[100005];
set<long long> S;
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &in[i]);
  }
  int ans = 0;
  sort(in, in + n);
  for (int i = 0; i < n; i++) {
    if (in[i] % k != 0 || (in[i] % k == 0 && S.find(in[i] / k) == S.end())) {
      ans++;
      S.insert(in[i]);
    }
  }
  printf("%d\n", ans);
  return 0;
}
