import java.util.PriorityQueue; import java.util.Scanner; import java.util.TreeSet; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 int n = in.nextInt(); int m = in.nextInt(); int max = 0; PriorityQueue<Integer> que = new PriorityQueue<>(); for(int i = 0; i< n; i++){ int fen = in.nextInt(); que.add(fen); max = Math.max(max,fen); // System.out.println("1:"+que +",max:"+max); } for(int j = 0; j< m;j++){ int cur = que.peek()+in.nextInt(); max = Math.max(max,cur); que.poll(); que.add(cur); System.out.println(max); } } }