#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, k, n, q, ans, t, cnt, c1, c2;
  vector<long long> v;
  unordered_map<long long, long long> m;
  cin >> n >> k;
  i = 0;
  while (i < n) {
    cin >> q;
    v.push_back(q);
    i++;
  }
  i = 0;
  cnt = 0;
  sort(v.begin(), v.end());
  while (i < n) {
    if (m[v[i]] == 0) {
      cnt++;
      m[k * v[i]]++;
    }
    i++;
  }
  cout << cnt;
  return (0);
}
