// UUID: 842126da-175f-4e3f-8362-2343eb055e93
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<utility>
using namespace std;
int n;
pair<int,int> a[111111];
bool f[111111];
void upd(long long int&res,int b,int x){
if(b%2)res += x;else
res -= x;
}
int main(){
int q;
scanf("%d%d",&n,&q);
for(int i=1; i<=n; i++){
scanf("%d",&a[i].first);
a[i].second = i;
}
sort(a+1,a+n+1);
reverse(a+1,a+n+1);
while(q--){
int x;
scanf("%d",&x);
int pnt = x;
long long int res = 0;
memset(f,0,sizeof(f));
for(int i=1; i<=n; i++){
int pos = a[i].second, val = a[i].first;
while(pnt <= n && f[pnt])pnt++;
if(pnt > n){
upd(res, i, val);
}else
if(pos > pnt){
upd(res, pos - x + 1, val);
f[pos] = true;
}else{
upd(res, pnt - x + 1, val);
f[pnt] = true;
}
}
cout << res << endl;
}
return 0;
}