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 bisect import bisect_left
n,k=map(int,input().split())
l=[int(x) for x in input().split()]
d={}
c1=0
c2=0
for i in l:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
l=list(set(l))
done=set([])
for i in l:
    if i*k in d and i not in done:
        if c1<c2:
            c1+=max(d[i],d[i*k])
            c2+=min(d[i],d[i*k])
            done.add(i*k)
        else:
            c2+=max(d[i],d[i*k])
            c1+=min(d[i],d[i*k])
            done.add(i*k)
    elif i*k not in d and i not in done:
        if c1<c2:
            c1+=(d[i])
        else:
            c2+=d[i]
print(max(c1,c2))
        