#include<bits/stdc++.h>
#define rep(i, n) for(long long i = 0; i < n; ++i)
#define rrep(i, n) for(long long i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using ll = long long;
using ui = unsigned int;
using ul = unsigned long long;
using ld = long double;
using v1i = vector<int>;
using v1ll = vector<ll>;
using v2i = vector<vector<int>>;
using v2ll = vector<vector<ll>>;
using v3i = vector<vector<vector<int>>>;
using v3ll = vector<vector<vector<ll>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr ll MOD = 1000000007;
constexpr ll MOD2 = 998244353;

int main(){
    int n, q; cin >> n >> q;
    v1ll v(n+1), a(n+1);
    rep(i, n) cin >> v[i];
    v[n] = 1e18+1e9;
    sort(v.begin(), v.end());
    rep(i, n+1) a[i] = v[i] - i - 1;
    rep(i, q) {
        ll k; cin >> k;
        int j = lower_bound(a.begin(), a.end(), k) - a.begin();
        ll ans = v[j] - (a[j] - k) - 1;
        cout << ans << "\n";
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
ll merge(vector<int>&arr1,vector<int>&arr2,int s,int e)
{
	int mid=(s+e)/2;
	ll cnt=0;
	int i=s,j=mid+1,k=s;
	while(i<=mid && j<=e){
		if(arr1[i]>arr1[j]){
			cnt+=(mid-i+1);
			arr2[k++]=arr1[j++];
		}
		else{
			arr2[k++]=arr1[i++];
		}
	}
	while(i<=mid)
	 arr2[k++]=arr1[i++];
	while(j<=e)
	 arr2[k++]=arr1[j++];
	for(int i=s; i<=e; i++)
	 arr1[i]=arr2[i];
	return cnt;
}
ll inversion(vector<int>&arr1,vector<int>&arr2,int s,int e)
{
	if(s<e){
		int mid=(s+e)/2;
		ll ans=0;
		ans+=inversion(arr1,arr2,s,mid);
		ans+=inversion(arr1,arr2,mid+1,e);
		ans+=merge(arr1,arr2,s,e);
		return ans;
	}
	return 0;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	vector<int>arr1(n);
	for(int i=0; i<n; i++)
	 cin>>arr1[i];
	vector<int>arr2(n);
	vector<int>arr3(n);
	arr2=arr1;
	arr3=arr2;
	ll ans=inversion(arr1,arr2,0,n-1);

	if(ans!=n-1){
		cout<<"-1";
		return 0;
	}
	else{
		arr2=arr3;
		vector<ll>temp;
		temp.push_back(arr2[0]);
		vector<ll>diff;
		map<int,int>rel;
		for(int i=1; i<n; i++){
			if(temp.back()<arr2[i])
			 temp.push_back(arr2[i]);
			else{
				temp.push_back(arr2[i]);
				int j=i;
				while(j>0){
					if(temp[j]<temp[j-1]){
						diff.push_back(j);
						if(rel[j]){
							cout<<"-1";
							return 0;
						}
						rel[j]++;
						swap(temp[j],temp[j-1]);
						j--;
					}
					else
					 break;
				}
			}
		}
		for(int i=0; i<diff.size(); i++)
		 cout<<diff[i]<<"\n";
	}
    return 0;
}