#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,m,x,y,max=0;
cin>>n>>m;
priority_queue<int,vector<int>,greater<>> s;
for(int i=0;i<n;i++){
cin>>x;
if(x>max)
max=x;
s.push(x);
}
while(m--){
cin>>x;
y=s.top()+x;
if(y>max)
max=y;
s.pop();
s.push(y);
cout<<max<<'\n';
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号