
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

using ll = long long;

bool comp(const pair<ll, ll> a, const pair<ll, ll> b) {
    if (a.first == b.first) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ll Kth(vector<pair<ll, ll>>& B, ll K) {
    auto l = lower_bound(B.begin(), B.end(), make_pair(K, INT64_MIN), comp);
    ll ans;
    if (l != B.end()) {
        ans = l->second - (l->first - K + 1);
    } else {
        l--;
        ans = l->second + (K - l->first);
    }

    return ans;
}

void Main() {
    // input
    ll N, Q; 
    cin >> N >> Q;
    vector<ll> A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<ll> K(Q);
    for (ll i = 0; i < Q; i++) {
        cin >> K[i];
    }



    // process
    vector<pair<ll, ll>> B(N);
    ll before = 0;
    ll count = 0;
    for (ll i = 0; i < N; i++) {
        count += A[i] - before - 1;
        before = A[i];
        B[i] = make_pair(count, A[i]);
    }



    // output
    for (ll i = 0; i < Q; i++) {
        ll ans = Kth(B, K[i]);
        cout << ans << endl;
    }

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

/*
 * Author: Moon-light
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair<int,int> PII;  
typedef pair<LL,LL> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VB;
typedef double db;

template <class T> void clear(T& a) { T().swap(a);}
template <class T,class S>
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template <class T,class S>
inline bool upmax(T&a, const S&b){ return a<b? a=b,1:0;}

//fast read(improved by fread)
char buf[1<<21],*p1=buf,*p2=buf;
inline int getc(){
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
}
inline int redi() {
    int ret = 0,f = 0;char ch = getc();
    while (!isdigit (ch)) {
        if (ch == '-') f = 1;
        ch = getc();
    }
    while (isdigit (ch)) {
        ret = ret * 10 + ch - 48;
        ch = getc();
    }
    return f?-ret:ret;
}

//global variable
const int N = 1;
const int mod = 1e9+7;

//functions
LL qmi(LL a,LL k,LL mod){
    LL res = 1;
    while(k){
        if(k&1) res = res*a%mod;
        k >>= 1;
        a = a*a%mod;
    }
    return mod;
}
int gcd(int a,int b) {
    return b==0? a:gcd(b,a%b);
}
//


//code from here! Come on! Have a pleasant experience~
int main()
{
    IO;
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    cout<<min(a,min(b,min(c,d)))<<endl;
    return 0;
}