import sys input = sys.stdin.readline from heapq import * N,M=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) Ai = [(a,i) for i,a in enumerate(A)] Ai.sort(reverse=True) a,i = Ai[0] offset = 1<<60 f = lambda a,b,i: (((a*offset//b)), M-i) heap = [ f(a,b,i) for b in B] heapify(heap) for a,i in Ai[1:]: for b in B: pi = f(a,b,i) if heap[0][0]>pi[0] or heap[0][0]==pi[0] and heap[0][1]>pi[1]:break heappush(heap, pi) pi2 = heappop(heap) ans = [] while heap: p,i = heappop(heap) # i = pi & ((1<<20)-1) i = M-i ans.append(i+1) ans = reversed(ans) print(*ans,sep="\n")