#include <bits/stdc++.h>
using namespace std;
int main ()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector<long long> a, b;
long long i,j,k,n,m,l=0,sum=0;
cin>>n;
for(i=0;i<n;++i){
cin>>k;
a.push_back(k);
}
cin>>m;
for(i=0;i<m;++i){
cin>>k;
b.push_back(k);
}
l=0;
sort(a.begin(),a.end());
for(i=0;i<n;++i){
sum=sum+a[i];
}
n;
for(i=0;i<m;++i){
cout<<sum-a[n-b[i]]<<endl;
}
return 0;
}