#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], flag[100005];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!flag[i]) {
      ans++;
      int pos = lower_bound(a + 1, a + 1 + n, (long long)m * a[i]) - a;
      if (a[pos] == (long long)m * a[i]) flag[pos] = true;
    }
  }
  cout << ans << endl;
}
