#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010];
map<long long, long long> mp;
int main() {
  long long n, i, n1, j, flag = 0, p, s, k, c = 0, c2 = 0;
  long long num;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    p = a[i];
    num = p * k;
    if (mp[p] == 0 && mp[num] == 0) {
      c++;
      num = p * k;
      mp[p] = 1;
      mp[num] = 1;
    }
  }
  cout << c << endl;
  return 0;
}
