#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void ri(T &i) {
  bool minus = false;
  char c;
  for (c = getchar(); (c < '0' || c > '9') && (c != '-'); c = getchar())
    ;
  if (c == '-') {
    minus = true;
    c = '0';
  }
  for (i = 0; c >= '0' && c <= '9'; c = getchar())
    i = (i << 3) + (i << 1) + (c - 48);
  if (minus) i = (~i) + 1;
}
int main() {
  int n;
  int k;
  cin >> n;
  cin >> k;
  vector<int> in;
  int t;
  for (int i = 0; i < n; i++) {
    ri(t);
    in.push_back(t);
  }
  sort(in.begin(), in.end());
  int cnt = 0;
  map<int, int> ss;
  for (int i = 0; i < n; i++) {
    int cur = in[i];
    if (cur % k == 0) {
      int tem = cur / k;
      if (ss[tem] == 1) {
      } else {
        ss[cur] = 1;
        cnt++;
      }
    } else {
      ss[cur] = 1;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
