// choker
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
using ul = unsigned long long;
const int maxN = 1e6 + 1;
const int mod = 1e9 + 7;
const int BLOCK_SIZE = 400;
const int LIM = 1e4;
//const int ep = 100;
const lli infty = 1e18;

const lli base = 37;
const int ep = 'a' - 1;

void FastInput()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

void InputFile()
{
    freopen("a.INP","r",stdin);
    //freopen("a.OUT","w",stdout);
}

int n,q;
lli a[maxN];
vector<lli> selct;
map<string,int> apr;

void Read()
{
    cin >> n >> q;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        string trans = to_string(a[i]);
        apr[trans] = 1;
    }
}

void Prc(lli m)
{
    lli mini = 1;
    lli maxi = 1e18 + 1e6;
    while(mini <= maxi)
    {
        lli mid = (mini + maxi) / 2;
        lli k = upper_bound(selct.begin(),selct.end(),mid) - selct.begin();
        if(mid - k == m)
        {
            string trans = to_string(mid);
            if(apr[trans] == 1) maxi = mid - 1;
            else
            {
                cout << mid <<'\n';
                return;
            }
        }
        if(mid - k < m)
        {
            mini = mid + 1;
        }
        if(mid - k > m)
        {
            maxi = mid - 1;
        }
    }
}

void Solve()
{
    sort(a + 1,a + n + 1);
    selct.push_back(a[1]);
    for(int i = 2; i <= n; i++)
    {
        if(a[i] != a[i-1]) selct.push_back(a[i]);
    }
    while(q--)
    {
        lli m;
        cin >> m;
        Prc(m);
    }
}

void Debug()
{

}


int main()
{
    FastInput();
    //InputFile();
    int test;
    //cin >> test;
    test = 1;
    while(test--)
    {
        Read();
        Solve();
        Debug();
    }
}

#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <tuple>
#include <numeric>
#include <climits>
using namespace std;


int main(int argc, char* argv[]){
	long long n,q;
	cin>>n>>q;
	vector<long long>a(n);
	vector<long long>query(q);
	vector<pair<long long,long long>> p;
	pair<long long, long long> p_;
	p_.first = 1;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(p_.first==a[i]){
			p_.first = a[i]+1;
		}else{
			p_.second = a[i]-1;
//			cout<<p_.first<<" "<<p_.second<<endl;
			p.push_back(p_);
			p_.first = a[i]+1;
		}
		if(i==n-1){
			p_.second = LLONG_MAX;
//			cout<<p_.first<<" "<<p_.second<<endl;
			p.push_back(p_);
		}
	}
	vector<long long> len;
	long long len_ = 0;
	for(long long i=0;i<p.size();i++){
		len_ += p[i].second - p[i].first +1;
		len.push_back(len_);
//		cout<<len_<<endl;
	}
	for(long long i=0;i<q;i++){
		cin>>query[i];
	}

	for(auto q_ : query ){
		auto itr = lower_bound(len.begin(),len.end(), q_);
		long long idx = distance(len.begin(),itr);
		long long idx_;
		if(idx==0){
			idx_ = q_ - 1;
		}else{
			idx_ = q_ - len[idx-1] -1;
		}
//		cout<<q_<<" "<<idx<<" "<<idx_<<endl;

		long long ans = p[idx].first+idx_;
		cout<<ans<<endl;
	}


}
