#include <bits/stdc++.h>
using namespace std;
int a[111111], b[1111], c[111], p[111][111];
int n, l = 0, m;
const int md = 100000000;
int main() {
  int n1 = 0, n2 = 0, p1, p2, j, i, z = 0, x, k;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  map<int, int> mp;
  for (i = 0; i < n; i++) {
    if (a[i] % m || mp[a[i] / m] == 0) {
      mp[a[i]] = ++z;
    }
  }
  cout << z;
}
