#include <bits/stdc++.h>
using namespace std;
long long a[100001], n, i, j, k, p, q, m;
std::set<long long> myset;
std::set<long long>::iterator it;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; i++)
    if (myset.find(a[i]) == myset.end()) myset.insert(m * a[i]);
  std::cout << myset.size();
  return 0;
}
