from fractions import Fraction
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
heap = []
cnt = [0]*N
for i in range(N):
    heappush(heap, (-Fraction(A[i], B[0]), i))
ans = []
for _ in range(M):
    v, i = heappop(heap)
    ans.append(i+1)
    cnt[i] += 1
    if cnt[i] < M:
        heappush(heap, (-Fraction(A[i], B[cnt[i]]), i))
print(*ans, sep="\n")