#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int INF = 1000 * 1000 * 1000;
const long long LINF = 1000000000000000000LL;
const double eps = 1e-9;
void prepare() {}
const int nmax = 100005;
set<long long> q;
int n, k;
int a[nmax];
bool solve() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    q.insert(a[i]);
  }
  if (k == 1) {
    cout << n << endl;
    return false;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (q.find(a[i]) != q.end()) q.erase((long long)a[i] * k);
  }
  cout << (int)q.size() << endl;
  return false;
}
int main() {
  prepare();
  while (solve())
    ;
  return 0;
}
