#include <bits/stdc++.h>
#include <queue>
#include <vector>
using namespace std;

int main() {
    int n,m;
    cin >> n >> m;
    priority_queue<long long, vector<long long>, greater<long long> > z账号初始分;    
    vector<long long> b比赛增加值;
    long long max = -1;                         // 记录最大值(比赛结束后的多个号中最大分数)
    while(n){
        long long t;
        cin >> t;
        if(t > max ){
            max = t;
        }
        z账号初始分.push(t);
        n--;
    }
    while(m){
        long long t;
        cin >> t;
        b比赛增加值.push_back(t);
        m--;    
    }
    for(int i=0;i<b比赛增加值.size();i++){
        int t = 0;
        t = z账号初始分.top() + b比赛增加值[i];
        if(t > max){
            max = t;
        }
        z账号初始分.pop();
        z账号初始分.push(t);
        cout << max << endl;
    }
}
// 64 位输出请用 printf("%lld")

找最大值倒还容易,直接搞个值一次一次比就行,小顶堆顶上自动是每次最小值直接top即可