#include <bits/stdc++.h>
using namespace std;
long long n, a[105000], k;
map<long long, long long> cel;
signed main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (long long i = 0; i < n; i++) {
    if (a[i] % k == 0 && cel[a[i] / k] == 1) continue;
    cel[a[i]]++;
    a[n]++;
  }
  cout << a[n];
}
