''' Yuki 2453 Seat Allocation Ai/Bj (i = 1..N, j = 1..M) を降り順にソートしたときのk番目のiを答える。 Challengeでfloatの割り算を着かれたのでDecimalにしてみる。 ''' from heapq import * from decimal import Decimal N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) X = [1] * N # それぞれの政党、次何番目か q = [] for i, a in enumerate(A): b = Decimal(str(B[0])) heappush(q, (b / Decimal(str(a)), i)) for i in range(M): _, p = heappop(q) print(p + 1) if X[p] < M: heappush(q, (Decimal(str(B[X[p]])) / Decimal(str(A[p])), p)) X[p] += 1