#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
void solve() {
  int n, k;
  cin >> n >> k;
  vi a(n);
  for (ll i = 0; i < n; i++) cin >> a[i];
  ;
  sort(a.begin(), a.end());
  set<int> ans;
  for (ll i = 0; i < (n); i++) {
    if (a[i] % k != 0) {
      ans.insert(a[i]);
    } else {
      if (ans.count(a[i] / k) == 0) ans.insert(a[i]);
    }
  }
  cout << ans.size() << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  while (t--) {
    solve();
  }
}
