#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll n, q;
  cin>>n>>q;
  vector<ll> a(n+1, 0), c(n+1, 0);
  for (int i = 1; i <= n; ++i)
  {
    cin>>a[i];
  }
  for (int i = 1; i <= n; ++i)
  {
    c[i] = a[i] - i;
  }

  for (int i = 0; i < q; ++i)
  {
    ll k;
    cin>>k;
    if (k > c[n]) {
      cout << a[n] + k - c[n] << "\n";
      continue;
    }
    ll l = 0, r = n;
    while (r -l > 1) {
      ll m = (l+r)/2;
      if (c[m] < k) l = m;
      else r = m;
    }
    cout << a[l] + k - c[l] << "\n";
  }

}
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

void solve(){
    ll x, y, a, b;
    read(x,y, a, b);
    ll count = 0;
    while( x < (x + b) / a && x <= (y -1) / a ){
        x *= a;
        count++;
    }
    count += (y - 1 - x) / b;
    cout << count << endl;
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}

