#ifdef __LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using PIL = pair<int,ll>;
using PLI = pair<ll,int>;
using PLL = pair<ll,ll>;
using Graph = vector<vector<int>>;
using Cost_Graph = vector<vector<PIL>>;

template<class T> bool chmin(T &a, T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b){a=b;return 1;}return 0;}
#define REP(i,n) for(int i=0;i<int(n);i++)
#define ROUNDUP(a,b) ((a+b-1)/b)
#define YESNO(T) cout<<(T?"YES":"NO")<<endl
#define yesno(T) cout<<(T?"yes":"no")<<endl
#define YesNo(T) cout<<(T?"Yes":"No")<<endl

const int INFint = 1 << 30;
const ll INFLL = 1LL << 60;
const ll MOD = 1000000007LL;
const double pi = 3.14159265358979;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    int n;
    string s;
    cin >> n >> s;
    vector<ll> a(n + 1);
    for (int i = 0; i < n + 1; i++){
        cin >> a[i];
    }

    vector<ll> diff(n);
    ll k = INFLL;
    for (int i = 0; i < n; i++){
        diff[i] = abs(a[i + 1] - a[i]);
        chmin(k,diff[i]);
    }

    cout << k << endl;
    
    vector<ll> mod(n + 1);
    for (int i = 0; i < n + 1; i++){
        mod[i] = a[i] % k;
    }

    for (int i = 0; i < k; i++){
        for (int j = 0; j < n + 1; j++){
            if (mod[j] > i) cout << ROUNDUP(a[j],k) << " ";
            else cout << a[j] / k << " ";
        }
        cout << "\n";
    }
}
#include<bits/stdc++.h>
 
using namespace std;
#define int long long int
 
 
/*void insert(stack<int>& st , int temp)
{
    if(st.empty())
    {
        st.push(temp);
        return;
    }
    
    int x = st.top();
    st.pop();
    insert(st , temp);
    st.push(x);
}
 
 
void reverse(stack<int>& st )
{
    if(st.size()== 1)
   {
      return;
   }
    
    int temp = st.top();
    st.pop();
    reverse(st );
    insert(st , temp);
    
}
 
void display(stack<int>& st)
{
    while(st.size())
    {
        cout<<st.top()<<" ";
        st.pop();
    }
}*/

int binary(int c[] , int n ,  int k)
{
    int l=0;
    int r =n-1;
    int ans = INT_MAX;
    
    while(l<=r)
    {
        int mid = (l+r)/2;
        
        if(c[mid]>=k)
        {
            if(ans>mid)
            ans = mid;
            
            r = mid-1;
        }
        else
        {
            l = mid+1;
        }
    }
    
    return ans;
}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,q;
    cin>>n>>q;
    
    int arr[n];
    
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    
    int c[n];
    
    for(int i=0;i<n;i++)
    {
        c[i] = arr[i]-(i+1);
    }
    
    while(q--)
    {
        int k;
        cin>>k;
        
        if(c[n-1]<k)
        {
            cout<<k+n<<endl;
        }
        else
        {
            int p = binary(c , n , k);

            // since we have 0 based index so we need not
            // to subtract 1 from p .
            cout<<(k+p)<<endl;
        }
    }
    
 
    
    return 0;
}