#include <bits/stdc++.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>    // abs() for float, and fabs()
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main()
{
  // 入力
  int N, Q;
  cin >> N >> Q;

  vector<ll> A(N), K(Q), C(N);
  rep(i, N)
    cin >> A[i];

  rep(i, Q)
    cin >> K[i];

  rep(i, N)
    C[i] = A[i] - (i+1);

  rep(i, Q){
    ll vec_index = lower_bound(C.begin(), C.end(), K[i]) - C.begin();
    // cout << K[i] << ':' << vec_index << endl;
    if(vec_index == N){
      cout << A[N-1] + (K[i] - C[N-1]) << endl;
    }else{
      cout << (A[vec_index] - 1) - (C[vec_index] - K[i])  << endl;
    }
  }

}
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
int x,y;
map<int,int>mp,vis;
int func(int v){
    if(x>=v) return x-v;
    if(vis[v]) return mp[v];
    vis[v]=1;
    int ans=v-x;
    // if(v==1) {mp[v]=ans;return ans;}
    if(v%2==1){
        ans=min({ans,1+func(v+1),1+func(v-1)});
    }
    else{
        ans=min(ans,1+func(v/2));
    }
    mp[v]=ans;
    return ans;
}
void solve(){
    cin>>x>>y;
    cout<<func(y);
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL); 
    int T=1;
    // cin>>T;
    while(T--){
        solve();
    }
}

