#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-9;
int main() {
  long long i, j, k, l, p, q, r, x, y, z, n, m, c(0), t, h, mn = pow(2, 62) - 1,
                                                            mx = 0;
  scanf("%lld", &n), scanf("%lld", &k);
  map<long long, bool> mp;
  long long a[n + 1];
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; i++)
    if (!mp.count(a[i])) ++c, mp[a[i] * k] = 1;
  printf("%lld\n", c);
}
