import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n,m = na() a = na() b = na() big = 10 ** 20 def f(x, y): return -((x * big * 2 + y) // (y * 2) ) from heapq import * hq = [] for i in range(n): heappush(hq, (f(a[i], b[0]), i)) c = [1] * n ans = [-1] * m for i in range(m): x, y = heappop(hq) #print(x) ans[i] = y + 1 if c[y] < m: heappush(hq, (f(a[y], b[c[y]]), y)) c[y] += 1 print(*ans,sep="\n")