#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-10;
int main() {
  long long N, K;
  cin >> N >> K;
  vector<long long> in;
  for (int i = 0; i < N; ++i) {
    long long tmp;
    cin >> tmp;
    in.push_back(tmp);
  }
  if (K == 1) {
    cout << N;
    return 0;
  }
  sort(in.begin(), in.end());
  int r = 0;
  long long result = N;
  for (int i = 0; i < N; ++i) {
    if (in[i] == -1 || r >= N) continue;
    long long nxt = in[i] * K;
    while (r < N && in[r] < nxt) ++r;
    if (r >= N) continue;
    if (in[r] == nxt) {
      --result;
      in[r] = -1;
      ++r;
    }
  }
  cout << result;
}
