#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int N = 1e5 + 1;
const long long inf = 2e9;
const long long OO = 1e18;
const long long MOD = 1e9 + 7;
int mx, ans;
int main() {
  int n, k, a;
  cin >> n >> k;
  set<int> ans;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (auto x : v)
    if (x % k != 0 || ans.find(x / k) == ans.end()) ans.insert(x);
  cout << (int)ans.size();
  return 0;
}
