A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x < y) from the set, such that y = x·k.

You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-multiple free subset.

Input

The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).

All the numbers in the lines are separated by single spaces.

Output

On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.

Examples

Input

6 2
2 3 6 5 4 10


Output

3

Note

In the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
long long max(long long a, long long b) {
  if (a < b) return b;
  return a;
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long X[] = {-1, 1, 0, 0};
long long Y[] = {0, 0, -1, 1};
long long XX[] = {-1, 1, 0, 0, -1, 1, -1, 1};
long long YY[] = {0, 0, -1, 1, -1, 1, 1, -1};
long long HX[] = {1, -1, 2, -2, 1, -1, -2, 2};
long long HY[] = {2, -2, 1, -1, -2, 2, 1, -1};
long long fpow(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res = res * x % 1000000007;
    }
    x = x * x % 1000000007;
    n >>= 1;
  }
  return (res % 1000000007);
}
long long binomialCoeff(long long n, long long k) {
  long long C[n + 1][k + 1];
  long long i, j;
  C[0][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= min(i, k); j++) {
      if (j == 0 || j == i)
        C[i][j] = 1;
      else
        C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007;
    }
  }
  return C[n][k];
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
void solve() {
  long long n, m;
  vector<string> v;
  long long arr[105][10005];
  long long ans;
  long long right[105][105];
  long long left[105][105];
  ans = (1LL << 60) - 1;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) arr[i][j] = v[i][j] - '0';
  }
  for (int j = 0; j < m; j++) {
    long long tot = 0;
    for (int i = 0; i < n; i++) {
      if (arr[i][j]) continue;
      long long l = j, r = j;
      long long cnt1 = 0, cnt2 = 0;
      while (arr[i][l] == 0) {
        l--;
        if (l < 0) l = m - 1;
        cnt1++;
        if (cnt1 > m) break;
      }
      while (arr[i][r] == 0) {
        r++;
        if (r >= m) r = 0;
        cnt2++;
        if (cnt2 > m) break;
      }
      if (min(cnt1, cnt2) > m) {
        cout << -1;
        return;
      }
      tot += min(cnt1, cnt2);
    }
    ans = min(ans, tot);
  }
  cout << ans;
}
long long okay(long long n, long long c[], long long d[], long long k) {
  for (int i = 0; i < n; i++) {
    if (d[i] == 1) {
      if (k < 1900) return -1;
    } else {
      if (k >= 1900) return -1;
    }
    k += c[i];
  }
  if (k >= 0 && k < 1e9) return k;
  return -1;
}
void answer() {
  long long n, k;
  cin >> n >> k;
  unsigned long long int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  unordered_map<unsigned long long int, unsigned long long int> m;
  for (int i = 0; i < n; i++) m[arr[i]] = 1;
  vector<vector<unsigned long long int> > v;
  for (int i = 0; i < n; i++) {
    vector<unsigned long long int> temp;
    unsigned long long int x = arr[i];
    while (m[x] == 1) {
      temp.push_back(x);
      m[x] = 2;
      x = k * 1LL * x;
    }
    if (temp.size()) v.push_back(temp);
  }
  long long ans = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].size() % 2) {
      ans += (v[i].size() + 1) / 2;
    } else
      ans += (v[i].size()) / 2;
  }
  cout << ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  answer();
}
