from heapq import heappush, heappop from fractions import Fraction N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) B.sort() q = [] # (score, a-index, b-index) for i, a in enumerate(A): heappush(q, (-Fraction(a, B[0]), i, 0)) ans = [] for _ in range(M): _, a_index, b_index = heappop(q) ans.append(a_index + 1) if b_index+1 < M: frac = -Fraction(A[a_index], B[b_index+1]) heappush(q, (frac, a_index, b_index+1)) print(*ans, sep='\n')