#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 2e18;
const long long maxn = 1e5 + 5;
long long a[maxn];
long long n, k;
unordered_map<long long, long long> mp;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  long long ans = 0;
  for (long long i = 0; i < n; i++)
    if (a[i] % k || !mp[a[i] / k]) {
      mp[a[i]]++;
      ans++;
    }
  cout << ans << '\n';
  return 0;
}
