N,M=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) from heapq import heappush,heappop S=[] T={} for i in range(N): x=A[i]*(10**20) x//=B[0] score=x*10**6+(10**5-i) heappush(S,-score) count=0 while True: count+=1 score=heappop(S) score=-score ans=score%(10**6) ans=10**5-ans print(ans+1) if not ans in T: T[ans]=1 else: T[ans]+=1 if count==M: break else: n=T[ans] x=A[ans]*10**20 x//=B[n] score=x*10**6+10**5-ans heappush(S,-score)