#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
const int OO = (int)1e9 + 7;
const int MAX = 109;
char c1, c2, c3;
string s1, s2, s3;
long long n, m, k, t, a, b, c, d, e, f, x, y, z, sol = 0, ans = 0;
long long ar[1000009];
map<long long, bool> vis;
int fun(int i) {
  int ret = 0;
  for (int i = 0; i < n; i++) {
    if (ar[i] % m == 0 && vis[ar[i] / m]) continue;
    vis[ar[i]] = 1;
    ret++;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> ar[i];
  sort(ar, ar + n);
  cout << fun(0);
  cout << "\n\n";
  return 0;
}
