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>
using namespace std;
int n, k;
map<int, vector<int> > mi;
vector<int> v;
int memo[50];
int f(int ind) {
  if (ind >= v.size()) return 0;
  if (ind == v.size() - 1) return 1;
  if (ind == v.size() - 2) {
    if (v[ind] + 1 != v[ind + 1]) return 2;
    return 1;
  }
  int& ret = memo[ind];
  if (ret != -1) return ret;
  ret = 0;
  if (v[ind] + 1 != v[ind + 1]) ret = max(ret, 1 + f(ind + 1));
  ret = max(ret, 1 + f(ind + 2));
  return ret;
}
int main() {
  scanf("%d %d", &n, &k);
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  for (int(i) = (0), _n = (n - 1); (i) <= _n; (i)++) {
    int x;
    scanf("%d", &x);
    int cnt = 0;
    while (x % k == 0) {
      x /= k;
      cnt++;
    }
    mi[x].push_back(cnt);
  }
  int ans = 0;
  for (__typeof(mi.begin()) it = mi.begin(); it != mi.end(); it++) {
    int prev1 = 0, prev2 = 0;
    sort(it->second.begin(), it->second.end());
    memset(memo, -1, sizeof(memo));
    v = it->second;
    ans += f(0);
  }
  cout << ans << endl;
  return 0;
}
