#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  sort(a, a + n);
  reverse(a, a + n);
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (mp[(long long)a[i] * k] == false) {
      mp[a[i]] = true;
      c++;
    }
  }
  cout << c << endl;
  return 0;
}
