#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  map<long long, long long> m;
  long long n, k, i, j;
  cin >> n >> k;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  j = 0;
  for (i = 0; i < n; i++) {
    if (a[i] % k != 0 || (a[i] % k == 0 && m[a[i] / k] == 0)) j++, m[a[i]] = 1;
  }
  cout << j;
}
