#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > q;
map<int, bool> mymap;
int n, k;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    q.push(x);
  }
  int sum = 0;
  while (!q.empty()) {
    int x = q.top();
    q.pop();
    if (x % k == 0 && mymap[x / k] == 1) continue;
    sum++;
    mymap[x] = 1;
  }
  printf("%d\n", sum);
  return 0;
}
