#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int N = 1e5 + 100;
int arr[N];
set<int> res;
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (n); ++i) cin >> arr[i];
  sort(arr, arr + n);
  for (int i = 0; i < (n); ++i) {
    if (arr[i] % k == 0 && res.count(arr[i] / k)) {
      continue;
    }
    res.insert(arr[i]);
  }
  cout << ((int)(res).size()) << "\n";
  return 0;
}
