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.
def list_to_int(a):
    a_c=[]
    for i in a:
        i=int(i)
        a_c.append(i)
    a=a_c
    a.sort()
    return a 

def find_multiplos(a):
    multiplos=[]
    for i in a:
        for e in range(1,i):
            if i%e==0:
                if e not in multiplos:
                    multiplos.append(e)
    return multiplos

n_1=input()
a=n_1.split()
n_2=input()
b=n_2.split()
a=list_to_int(a)
b=list_to_int(b)

l=max(a)
o=0
multiplos_a=find_multiplos(a)
multiplos_b=find_multiplos(b)
o=0
while o<l:
    if max(multiplos_a) in multiplos_b:
        
        print(max(multiplos_a)) 
        break
    else:
        multiplos_a.remove(max(multiplos_a))
        o+=1
  							   		 	 	    	  		   	