#include <bits/stdc++.h>
using namespace std;
map<long long int, bool> a;
map<long long int, bool>::iterator it;
int main() {
  ios::sync_with_stdio(false);
  long long int n, k, i, num, count = 0;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> num;
    a[num] = 1;
  }
  for (it = a.begin(); it != a.end(); ++it) {
    num = it->first;
    if (it->second == 1) {
      count += 1;
      a[num * k] = 0;
    }
  }
  cout << count << endl;
  return 0;
}
