#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<int, int> &i, const pair<int, int> &j) {
  return i.second > j.second;
}
int n, d;
vector<pair<long long, long long>> a;
int lis(vector<int> const &a, int l, int r) {
  int n = a.size();
  const int INF = 1e9;
  vector<int> d(n + 1, INF);
  d[0] = -INF;
  for (int i = l; i <= r; i++) {
    int j = upper_bound(d.begin(), d.end(), a[i]) - d.begin();
    if (d[j - 1] < a[i] && a[i] < d[j]) d[j] = a[i];
  }
  int ans = 0;
  for (int i = 0; i <= r - l + 1; i++) {
    if (d[i] < INF) ans = i;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long k;
  cin >> k;
  set<long long> s;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    s.insert(x);
  }
  if (n == 1) {
    cout << "1"
         << "\n";
  } else if (k == 1) {
    cout << n << "\n";
  } else {
    for (auto x : s)
      if (s.find(k * x) != s.end()) s.erase(k * x);
    cout << s.size() << "\n";
  }
  return 0;
}
