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* &lt; *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.
The first line of the input contains two integers *n* and *k* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>, 1 ≤ *k* ≤ 10<sup class="upper-index">9</sup>). The next line contains a list of *n* distinct positive integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).

All the numbers in the lines are separated by single spaces.
from collections import defaultdict, deque, Counter
from math import sqrt, ceil, log2, factorial, gcd
from itertools import combinations, permutations
from functools import lru_cache
from heapq import heappop, heappush, heapreplace, heapify
from bisect import bisect_left, bisect_right
from fractions import Fraction
from sys import stdin, stdout, setrecursionlimit
inf = float('inf')
setrecursionlimit(1 << 21)
write = lambda x='', end='\n': stdout.write(str(x) + end)
writes = lambda x, step=' ': stdout.write(step.join(map(str, x)) + '\n')
read = lambda x=int: x(stdin.readline().strip())
reads = lambda x=int: map(x, stdin.readline().strip().split())


n, k = reads()
s = set()
for i in sorted(reads()):
    t = i // k
    if t not in s:
        s.add(i)
    else:
        s.remove(t)
        s.add(i)
write(len(s))
