import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int[] b = new int[m + 1]; for (int i = 0; i < m; i++) { b[i] = sc.nextInt(); } sc.close(); b[m] = 1000000007; PriorityQueue que = new PriorityQueue<>(); for (int i = 0; i < n; i++) { Obj o = new Obj(); o.a = a[i]; o.b = b[0]; o.i = i; o.idx = 0; que.add(o); } PrintWriter pw = new PrintWriter(System.out); for (int i = 0; i < m; i++) { Obj o = que.poll(); pw.println(o.i + 1); o.idx++; o.b = b[o.idx]; que.add(o); } pw.flush(); } static class Obj implements Comparable { int a, b, i, idx; @Override public int compareTo(Obj o) { long v1 = (long) a * o.b; long v2 = (long) b * o.a; if (v1 != v2) { return Long.compare(v2, v1); } return i - o.i; } } }