import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); List parties = new ArrayList<>(); for (int i = 0; i < n; i++) { parties.add(new Party(i, sc.nextInt())); } Party.base = new long[m + 1]; for (int i = 0; i < m; i++) { Party.base[i] = sc.nextInt(); } PriorityQueue queue = new PriorityQueue<>(parties); StringBuilder sb = new StringBuilder(); for (int i = 0; i < m; i++) { Party x = queue.poll(); sb.append(x).append("\n"); x.add(); queue.add(x); } System.out.print(sb); } static class Party implements Comparable { static long[] base; int idx; int value; int current; public Party(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Party another) { int ans = Long.compare(another.value * base[current], value * base[another.current]); if (ans == 0) { return idx - another.idx; } else { return ans; } } public String toString() { return String.valueOf(idx + 1); } public void add() { current++; } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }