#include <bits/stdc++.h>
using namespace std;
int n, k, res;
map<int, int> d;
int a[200000];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n);
  for (int i = 0; i < n; i++)
    if (a[i] % k || !d.count(a[i] / k)) d[a[i]] = 1, res++;
  cout << res << endl;
  return 0;
}
