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

const int N = 1e5+7;
bitset<N> pos;
long long a[N];
long long upto[N];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, q;
    cin>>n>>q;

    for (int i=1; i<=n; i++)    {
        cin>>a[i];
        upto[i] = a[i] - i;
    }

    while (q--) {
        long long z;
        cin>>z;

        int id = lower_bound(upto, upto+n+1, z) - upto - 1;
        assert(upto[id] <= z);
        cout<<a[id] + z - upto[id]<<endl;
    }
}


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

int gcd(int a, int b)
{
   int t =min(a,b);
    a=max(a,b);
    b =t;
    while(a%b!=0)
    {
       int temp =b;
        b=a%b;
        a=temp;
    }
    return b;
}

int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,q;
    cin>>n>>q;
    vector<long long >a(n);
    
    for(int i =0; i<n;i++)
    {
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    unordered_map<long long int,long long int>mp;
    // unordered_map<long long int,long long int>dc;
    for(int i =0; i<q;i++)
    {
        long long k;
        cin>>k;
        
        if(mp.find(k)!=mp.end())
        {
            cout<<mp[k]<<'\n';
        }
        else
        {
            int id =int(upper_bound(a.begin(),a.end(),k)-a.begin());
            if(id ==0)
            {
                mp[k]=k;
                
                cout<<k<<"\n";
            }else
            {
                if(id ==n)
                {
                    mp[k]=k+id;
                    
                    cout<<k+id<<'\n';
                }
                else
                {
                    while(id<n&&(k+id) >=a[id])
                    {
                        id++;
                        // mp[k+id] =k;
                    }
                    mp[k]=k+id;
                    cout<<k+id<<'\n';;
                }
            }
        }
        
        
    }
    
    
        
    return 0;
}