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

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define deb(x) cout << #x << " : " << x << " "

template<class X>
void input(X *arr, int n){
    for(int i=0; i<n; ++i) cin >> arr[i];
}

template<class X>
void input(vector<X>&arr, int n){
    for(int i=0; i<n; ++i) cin >> arr[i];
}

template<class X>
void print(X *arr, int n){
    for(int i=0; i<n; ++i) cout << arr[i] << " ";
    cout << "\n";
}

template<class X>
void print(vector<X>&arr, int n){
    for(int i=0; i<n; ++i) cout << arr[i] << " ";
    cout << "\n";
}

int main(){
	FAST;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int test = 1;
	//cin >> test;
	for(int tt=1; tt<=test; ++tt){
		ll arr[3];
		input(arr, 3);
		sort(arr, arr+3);
		cout << arr[1] + arr[2] << "\n";	
	}
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main()
{
    int n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<ll> c(n);
    for (int i = 0; i < n; i++) {
        c[i] = a[i] - (i + 1);
    }

    while(q--) {
        ll k; cin >> k;

        if (k > c.back()) {
            cout << a.back() + (k - c.back()) << "\n";
        }
        else {
            int i = lower_bound(c.begin(), c.end(), k) - c.begin();
            cout << (a[i] - 1) - (c[i] - k) << "\n";
        }
    }
    return 0;
}
