#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > Q;
const int INF = 1e9 + 9;
struct cmp {
  bool operator()(pair<int, int> const &a, pair<int, int> const &b) {
    if (a.first == b.first) return a.second > b.second;
    return a.first < b.first;
  }
};
int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> v;
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
    m[x]++;
  }
  sort(v.begin(), v.end());
  long long cnt = 0;
  for (long long i = 0; i < n; i++) {
    if (m[v[i]]) {
      cnt++;
      m[k * v[i]] = 0;
    }
  }
  cout << cnt << endl;
}
