#include <bits/stdc++.h>
using namespace std;
const int MAXN = int(1e5) + 256;
int n, k, a[MAXN];
vector<int> v;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; ++i) {
    if ((a[i] % k) || !(binary_search(v.begin(), v.end(), a[i] / k))) {
      v.push_back(a[i]);
    }
  }
  cout << v.size();
  exit(0);
}
