#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, a;
  cin >> n >> m;
  map<long long, long long> mp;
  while (n--) {
    cin >> a;
    mp[a] = 1;
  }
  if (m == 1) return cout << mp.size() << endl, 0;
  for (auto i : mp) {
    if (i.second == 0 || mp.find(i.first * m) == mp.end()) continue;
    mp[i.first * m] = 0;
  }
  long long sum = 0;
  for (auto i : mp) sum += i.second;
  cout << sum << endl;
  return 0;
}
