
#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795
#define max1 101
#define MOD 1000000007

#define read(type) readInt<type>()

#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}

signed main(){
int n;
cin>>n;
int a[n];
FOR(i,n){
cin>>a[i];
if(a[i]<0){a[i]*=-1;}
}
int x=0;
FOR(i,n){
x+=a[i];}
out(x);
x=0;
FOR(i,n){
x+=a[i]*a[i];
}
double ans=(double)sqrt(x);
cout<<fixed<<setprecision(15)<<ans<<endl;
x=0;
FOR(i,n){
x=max(x,a[i]);}
out(x);
}

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define forn(i,n) for(int i = 0; i < n; i++)
int32_t main() {
    int n, q, k; cin >> n >> q;
    vector<int> a(n);
    forn(i, n) cin >> a[i];
    vector<int> ps(n);
    ps[0] = a[0] - 1;
    forn(i, n - 1) ps[i + 1] = ps[i] + a[i + 1] - a[i] - 1;
    while (q--) {
        cin >> k;
        int x = --lower_bound(ps.begin(), ps.end(), k) - ps.begin();
        if (x == -1) cout << k;
        else cout << a[x] + k - ps[x];
        cout << "\n";
    }
}