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<<30 f = lambda a,b,i: (((a*offset//b)<<30) +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]>=pi:break heappush(heap, pi) pi2 = heappop(heap) ans = [] while heap: pi = heappop(heap) i = pi & ((1<<20)-1) i = M-i ans.append(i+1) ans = reversed(ans) print(*ans,sep="\n")