#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 5;
long long N, K;
long long v[MAXN];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> v[i];
  sort(v, v + N);
  long long resp = N;
  for (int i = 0; i < N; i++) {
    long long value = v[i] * K;
    int l = i + 1, r = N - 1;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (v[mid] == value) {
        resp--;
        v[mid] = -1;
        break;
      }
      if (v[mid] < value)
        l = mid + 1;
      else
        r = mid - 1;
    }
  }
  cout << resp << endl;
  return 0;
}
