#include <bits/stdc++.h>
using namespace std;
long long int N, M;
pair<long long int, long long int> ar[100005], er[100005];
bool used[100005];
void oku() {
  cin >> N >> M;
  for (long long int i = 1; i <= N; i++) scanf("%I64d", &ar[i].first);
  if (M == 1) {
    cout << N << endl;
    return;
  }
  sort(ar + 1, ar + 1 + N);
  for (long long int i = 1; i <= N; i++) er[i].first = ar[i].first * M;
  int k = 1, say = 0;
  for (long long int i = 1; i <= N && k <= N; i++)
    for (; k <= N; k++) {
      if (er[i].first == ar[k].first && !used[er[i].second]) {
        er[k].second = i;
        used[i] = 1;
        say++;
        break;
      }
      if (er[i].first < ar[k].first) break;
    }
  cout << N - say << endl;
}
int main() {
  oku();
  return 0;
}
