#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, k;
  scanf("%I64d", &n);
  ;
  scanf("%I64d", &k);
  ;
  vector<long long> v;
  map<long long, bool> m;
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%I64d", &x);
    ;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  long long sum = 0, maxx = 0;
  for (int i = 0; i < n; i++) {
    if (m[v[i]] == 0) {
      m[v[i] * k] = 1;
      sum++;
    }
  }
  cout << sum;
  return 0;
}
