/*                                              +---------------------+
					        | BRYAN MAURICIO 2006 |
                                                +---------------------+
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define ar array

#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define allr(c) (c).rbegin(), (c).rend()
#define sz(x) (int)(x).size()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define pi 3.14159265358979323846
#define lcm(a, b)  (a * b) / ( __gcd(a, b ) )
#define gcd(a,b) __gcd(a,b)
#define tests int t; cin>>t; while(t--)
#define test int t=1;while(t--)
#define mod 1000000007
#define srt(y) sort(all(y))
#define srtr(y) sort(allr(y))
#define uniq(y) y.erase(unique(all(y)), y.end())

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T> bool umin(T& a, const T& b) {
	return b<a?a=b, 1:0;
}
template<class T> bool umax(T& a, const T& b) {
	return a<b?a=b, 1:0;
}

ll FIRSTTRUE(function<bool(ll)> f, ll lb, ll rb) {
	while(lb<rb) {
		ll mb=(lb+rb)/2;
		f(mb)?rb=mb:lb=mb+1;
	}
	return lb;
}
ll LASTTRUE(function<bool(ll)> f, ll lb, ll rb) {
	while(lb<rb) {
		ll mb=(lb+rb+1)/2;
		f(mb)?lb=mb:rb=mb-1;
	}
	return lb;
}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
	cin >> x;
}
void read(double& d) {
	string t;
	read(t);
	d=stod(t);
}
void read(long double& d) {
	string t;
	read(t);
	d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(vt<A>& x) {
	EACH(a, x)
		read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
	EACH(a, x)
		read(a);
}

string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vt<bool> v) {
	string res;
	FOR(sz(v))
		res+=char('0'+v[i]);
	return res;
}

template<size_t S> string to_string(bitset<S> b) {
	string res;
	FOR(S)
		res+=char('0'+b[i]);
	return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
		if(!f)
			res+=' ';
		f=0;
		res+=to_string(x);
	}
    return res;
}

template<class A> void write(A x) {
	cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
	write(h);
	write(t...);
}
void print() {
	write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
	write(h);
	if(sizeof...(t))
		write(' ');
	print(t...);
}

void DBG() {
	cerr << "]" << endl;
}
template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h);
	if(sizeof...(t))
		cerr << ", ";
	DBG(t...);
}
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

template<class T> void offset(ll o, T& x) {
	x+=o;
}
template<class T> void offset(ll o, vt<T>& x) {
	EACH(a, x)
		offset(o, a);
}
template<class T, size_t S> void offset(ll o, ar<T, S>& x) {
	EACH(a, x)
		offset(o, a);
}

mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b) {
	return uniform_int_distribution<ll>(a, b)(mt_rng);
}

template<class T, class U> void vti(vt<T> &v, U x, size_t n) {
	v=vt<T>(n, x);
}
template<class T, class U> void vti(vt<T> &v, U x, size_t n, size_t m...) {
	v=vt<T>(n);
	EACH(a, v)
		vti(a, x, m);
}

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

void solve() {
    int a;
    read(a);
    vt<ll> y(a);
    read(y);
    int b;
    read(b);
    vt<ll> x(b);
    read(x);
    srtr(y);
    for(int i = 0;i<b;i++) {
        int ans = 0,g=x[i];
        for(int j = 0;j<a;j++) {
            ans+=y[j];
        }
        ans-=y[g-1];
        print(ans);
    }
}

int main() {
    ios;

    test {
        solve();
    }
}


/*                                              +---------------------+
					        | BRYAN MAURICIO 2006 |
                                                +---------------------+
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define ar array

#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define allr(c) (c).rbegin(), (c).rend()
#define sz(x) (int)(x).size()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define pi 3.14159265358979323846
#define lcm(a, b)  (a * b) / ( __gcd(a, b ) )
#define gcd(a,b) __gcd(a,b)
#define tests int t; cin>>t; while(t--)
#define test int t=1;while(t--)
#define mod 1000000007
#define srt(y) sort(all(y))
#define srtr(y) sort(allr(y))
#define uniq(y) y.erase(unique(all(y)), y.end())

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T> bool umin(T& a, const T& b) {
	return b<a?a=b, 1:0;
}
template<class T> bool umax(T& a, const T& b) {
	return a<b?a=b, 1:0;
}

ll FIRSTTRUE(function<bool(ll)> f, ll lb, ll rb) {
	while(lb<rb) {
		ll mb=(lb+rb)/2;
		f(mb)?rb=mb:lb=mb+1;
	}
	return lb;
}
ll LASTTRUE(function<bool(ll)> f, ll lb, ll rb) {
	while(lb<rb) {
		ll mb=(lb+rb+1)/2;
		f(mb)?lb=mb:rb=mb-1;
	}
	return lb;
}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
	cin >> x;
}
void read(double& d) {
	string t;
	read(t);
	d=stod(t);
}
void read(long double& d) {
	string t;
	read(t);
	d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(vt<A>& x) {
	EACH(a, x)
		read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
	EACH(a, x)
		read(a);
}

string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vt<bool> v) {
	string res;
	FOR(sz(v))
		res+=char('0'+v[i]);
	return res;
}

template<size_t S> string to_string(bitset<S> b) {
	string res;
	FOR(S)
		res+=char('0'+b[i]);
	return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
		if(!f)
			res+=' ';
		f=0;
		res+=to_string(x);
	}
    return res;
}

template<class A> void write(A x) {
	cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
	write(h);
	write(t...);
}
void print() {
	write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
	write(h);
	if(sizeof...(t))
		write(' ');
	print(t...);
}

void DBG() {
	cerr << "]" << endl;
}
template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h);
	if(sizeof...(t))
		cerr << ", ";
	DBG(t...);
}
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

template<class T> void offset(ll o, T& x) {
	x+=o;
}
template<class T> void offset(ll o, vt<T>& x) {
	EACH(a, x)
		offset(o, a);
}
template<class T, size_t S> void offset(ll o, ar<T, S>& x) {
	EACH(a, x)
		offset(o, a);
}

mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b) {
	return uniform_int_distribution<ll>(a, b)(mt_rng);
}

template<class T, class U> void vti(vt<T> &v, U x, size_t n) {
	v=vt<T>(n, x);
}
template<class T, class U> void vti(vt<T> &v, U x, size_t n, size_t m...) {
	v=vt<T>(n);
	EACH(a, v)
		vti(a, x, m);
}

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

void solve() {
    int a;
    read(a);
    vt<ll> y(a);
    read(y);
    int b;
    read(b);
    vt<ll> x(b);
    read(x);
    srtr(y);
    for(int i = 0;i<b;i++) {
        int ans = 0;
        for(int j = 0;j<x[i]-1;j++) {
            ans+=y[j];
        }
        for(int k = x[i];k<a;k++) {
            ans+=y[k];
        }
        print(ans);
    }
}

int main() {
    ios;

    test {
        solve();
    }
}


/*                                              +---------------------+
					        | BRYAN MAURICIO 2006 |
                                                +---------------------+
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define ar array

#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define allr(c) (c).rbegin(), (c).rend()
#define sz(x) (int)(x).size()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define pi 3.14159265358979323846
#define lcm(a, b)  (a * b) / ( __gcd(a, b ) )
#define gcd(a,b) __gcd(a,b)
#define tests int t; cin>>t; while(t--)
#define test int t=1;while(t--)
#define mod 1000000007
#define srt(y) sort(all(y))
#define srtr(y) sort(allr(y))
#define uniq(y) y.erase(unique(all(y)), y.end())

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T> bool umin(T& a, const T& b) {
	return b<a?a=b, 1:0;
}
template<class T> bool umax(T& a, const T& b) {
	return a<b?a=b, 1:0;
}

ll FIRSTTRUE(function<bool(ll)> f, ll lb, ll rb) {
	while(lb<rb) {
		ll mb=(lb+rb)/2;
		f(mb)?rb=mb:lb=mb+1;
	}
	return lb;
}
ll LASTTRUE(function<bool(ll)> f, ll lb, ll rb) {
	while(lb<rb) {
		ll mb=(lb+rb+1)/2;
		f(mb)?lb=mb:rb=mb-1;
	}
	return lb;
}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
	cin >> x;
}
void read(double& d) {
	string t;
	read(t);
	d=stod(t);
}
void read(long double& d) {
	string t;
	read(t);
	d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(vt<A>& x) {
	EACH(a, x)
		read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
	EACH(a, x)
		read(a);
}

string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vt<bool> v) {
	string res;
	FOR(sz(v))
		res+=char('0'+v[i]);
	return res;
}

template<size_t S> string to_string(bitset<S> b) {
	string res;
	FOR(S)
		res+=char('0'+b[i]);
	return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
		if(!f)
			res+=' ';
		f=0;
		res+=to_string(x);
	}
    return res;
}

template<class A> void write(A x) {
	cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
	write(h);
	write(t...);
}
void print() {
	write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
	write(h);
	if(sizeof...(t))
		write(' ');
	print(t...);
}

void DBG() {
	cerr << "]" << endl;
}
template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h);
	if(sizeof...(t))
		cerr << ", ";
	DBG(t...);
}
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

template<class T> void offset(ll o, T& x) {
	x+=o;
}
template<class T> void offset(ll o, vt<T>& x) {
	EACH(a, x)
		offset(o, a);
}
template<class T, size_t S> void offset(ll o, ar<T, S>& x) {
	EACH(a, x)
		offset(o, a);
}

mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b) {
	return uniform_int_distribution<ll>(a, b)(mt_rng);
}

template<class T, class U> void vti(vt<T> &v, U x, size_t n) {
	v=vt<T>(n, x);
}
template<class T, class U> void vti(vt<T> &v, U x, size_t n, size_t m...) {
	v=vt<T>(n);
	EACH(a, v)
		vti(a, x, m);
}

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

void solve() {
    int a;
    read(a);
    vt<int> y(a);
    read(y);
    int b;
    read(b);
    vt<int> x(b);
    read(x);
    srtr(y);
    for(int i = 0;i<b;i++) {
        int ans = 0;
        for(int j = 0;j<x[i]-1;j++) {
            ans+=y[j];
        }
        for(int k = x[i];k<a;k++) {
            ans+=y[k];
        }
        print(ans);
    }
}

int main() {
    ios;

    test {
        solve();
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,x,su=0,q;
    cin >> n;
    vector<int> arr;
    for(i=0;i<n;i++)
    {
        cin >> x;
        arr.push_back(x);
        su=su+x;
    }
    sort(arr.rbegin(),arr.rend());
    cin >> q;
    for(i=0;i<q;i++)
    {
        cin >> x;
        cout << su-arr[x-1];
        cout << "\n";
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,x,su=0,q;
    cin >> n;
    vector<int> arr;
    for(i=0;i<n;i++)
    {
        cin >> x;
        arr.push_back(x);
        su=su+x;
    }
    sort(arr.rbegin(),arr.rend());
    cin >> q;
    for(i=0;i<n;i++)
    {
        cin >> x;
        cout << su-arr[x-1];
        cout << "\n";
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int n,i,x,su=0,q;
    cin >> n;
    vector<int> arr;
    for(i=0;i<n;i++)
    {
        cin >> x;
        arr.push_back(x);
        su=su+x;
    }
    sort(arr.rbegin(),arr.rend());
    cin >> q;
    for(i=0;i<q;i++)
    {
        cin >> x;
        cout << su-arr[x-1];
        cout << "\n";
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i,x,su=0,q;
    cin >> n;
    vector<int> arr;
    for(i=0;i<n;i++)
    {
        cin >> x;
        arr.push_back(x);
        su=su+x;
    }
    sort(arr.rbegin(),arr.rend());
    cin >> q;
    for(i=0;i<q;i++)
    {
        cin >> x;
        cout << su-arr[x-1];
        cout << "\n";
    }
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,x,su=0,q;
    cin >> n;
    vector<int> arr;
    for(i=0;i<n;i++)
    {
        cin >> x;
        arr.push_back(x);
        su=su+x;
    }
    sort(arr.rbegin(),arr.rend());
    cin >> q;
    for(i=0;i<n;i++)
    {
        cin >> x;
        cout << su-arr[x-1];
    }
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m;
    cin >> n;
    vector<int> a(n);
    for(auto &x: a) {
        cin >> x;
    }
    cin >> m;
    vector<int> q(m);
    for(auto &x: q) {
        cin >> x;
    }
    sort(a.begin(), a.end());
    for(int i=0; i<m; i++) {
        int ans = 0, j;
        for(j=0; j<n-q[i]; j++) {
            ans += a[j];
        }
        j++;
        while(j < n) {
            ans+=a[j];
            j++;
        }
        cout << ans << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, sum = 0;
    cin >> n;
    vector<int> a(n);
    for(auto &x: a) {
        cin >> x;
        sum += x;
    }
    sort(a.begin(), a.end());
    cin >> m;
    for(int i = 0; i < m; i++) {
        int c;
        cin >> c;
        cout << sum - a[n-c] << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, sum = 0;
    cin >> n;
    vector<int> a(n);
    vector<long long> res(n, -1);
    for(auto &x: a) {
        cin >> x;
        sum += x;
    }
    sort(a.begin(), a.end());
    cin >> m;
    for(int i = 0; i < m; i++) {
        int c;
        cin >> c;
        if(res[c] == -1) {
            res[c] = sum - a[n-c];
        }
        cout << res[c] << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m;
    cin >> n;
    vector<int> a(n), sum(n, 0);
    for(auto &x: a) {
        cin >> x;
    }
    cin >> m;
    vector<int> q(m);
    for(auto &x: q) {
        cin >> x;
    }
    sort(a.begin(), a.end());
    sum[0] = a[0];
    for(int i=1;i<n;i++) {
        sum[i] += (sum[i-1] + a[i]);
    }
    for(int i=0; i<m; i++) {
        int ans = 0;
        // for(j=0; j<n-q[i]; j++) {
        //     ans += a[j];
        // }
        // j++;
        // while(j < n) {
        //     ans+=a[j];
        //     j++;
        // }
        // ans += sum[n - q[i] - 1];
        // for(j = n-1; j > n - q[i]; j--) {
        //     ans += a[j];
        // }
        ans = sum[n-1] - a[n - q[i]];
        cout << ans << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main() {
    int n, m, q;
    cin >> n;
    vector <ll> a(n);
    ll sum = 0;
    for(int i=0; i<n;i++) {
        cin >> a[i];
        sum += a[i];
    }
    sort(a.rbegin(), a.rend());
    cin >> m;
    for(int i=0; i<m;i++) {
        cin >> q;
        cout << sum - a[q - 1] << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m;
    cin >> n;
    vector<int> a(n), sum(n, 0);
    for(auto &x: a) {
        cin >> x;
    }
    cin >> m;
    vector<int> q(m);
    for(auto &x: q) {
        cin >> x;
    }
    sort(a.begin(), a.end());
    sum[0] = a[0];
    for(int i=1;i<n;i++) {
        sum[i] += (sum[i-1] + a[i]);
    }
    for(int i=0; i<m; i++) {
        int ans = 0, j;
        // for(j=0; j<n-q[i]; j++) {
        //     ans += a[j];
        // }
        // j++;
        // while(j < n) {
        //     ans+=a[j];
        //     j++;
        // }
        ans += sum[n - q[i] - 1];
        for(j = n-1; j > n - q[i]; j--) {
            ans += a[j];
        }
        cout << ans << "\n";
    }
}


#include<bits/stdc++.h>
using namespace std;

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define ll long long int

int main()
{
    faster();

    int n;
    cin>>n;
    int a[n] = {0};
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);
    int m;
    cin>>m;
    int q[m]={0};
   // mem(r,-1);
    for(int i=0;i<m;i++){
        cin>>q[i];
        int w = q[i];
        cout<< sum - a[n-w] <<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define ll long long int

const int MX = 10000001;
ll ans[MX];

int main()
{
    faster();

    int n;
    cin>>n;
    int a[n];
    ll sum =0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);

    mem(ans,-1);
    int m;
    cin>>m;
    int q;
    for(int i=0;i<m;i++){
        cin>>q;
        if(ans[i]==-1){
            ans[q] = sum - a[n-q];
        }
        cout<<ans[q]<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define ll long long int

const int MX=200002;
int re[MX];

int main()
{

    int n,m;
    cin>>n;
    int a[n];
    ll sum =0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);
    mem(re,-1);
    int q;
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>q;
        if(re[i]==-1){
            re[q] = sum - a[n-q];
        }
        cout<<re[q]<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define ll long long int

const int MX = 1000000;
ll r[MX];

int main()
{
    faster();

    int n;
    cin>>n;
    int a[n];
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);
    int m;
    cin>>m;
    int q;
    mem(r,-1);
    for(int i=0;i<m;i++){
        cin>>q;
        if(r[i]==-1){
            r[q] = sum - a[n-q];
            //dbg(a[n-q]);
        }
        cout<<r[q]<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define ll long long int

const int MX = 100001;
ll r[MX];

int main()
{
    faster();

    int n;
    cin>>n;
    int a[n];
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);
    int m;
    cin>>m;
    int q;
    mem(r,-1);
    for(int i=0;i<m;i++){
        cin>>q;
        if(r[i]==-1){
            r[q] = sum - a[n-q];
            //dbg(a[n-q]);
        }
        cout<<r[q]<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define ll long long int

const int MX = 1000001;
ll ans[MX];

int main()
{
    faster();

    int n;
    cin>>n;
    int a[n];
    ll sum =0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);

    mem(ans,-1);
    int m;
    cin>>m;
    int q;
    for(int i=0;i<m;i++){
        cin>>q;
        if(ans[i]==-1){
            ans[q] = sum - a[n-q];
        }
        cout<<ans[q]<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long int

int main()
{
    //faster();

    int n;
    cin>>n;
    int a[n] = {0};
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);
    int m;
    cin>>m;
    int q[m]={0};
   // mem(r,-1);
    for(int i=0;i<m;i++){
        cin>>q[i];
        int w = q[i];
        cout<< sum - a[n-w] <<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define ll long long int

const int MX = 200001;
ll r[MX];
int a[MX];

int main()
{
    faster();

    int n;
    cin>>n;
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);
    int m;
    cin>>m;
    int q;
   // mem(r,-1);
    for(int i=0;i<m;i++){
        cin>>q;
        r[q] = sum - a[n-q];

        cout<<r[q]<<endl;
    }

    return 0;
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }
template <typename T> inline void printInteger(T &x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}
template <typename T> inline void print(T &x) { cout << x; }
template <typename T> inline void print(int &x) { printInteger(x); }
template <typename T> inline void print(ll &x) { printInteger(x); }
template<typename T1> inline void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1> inline void print(int n, T1* t1) { while(n--) print(*(t1++)); putchar('\n'); }
const char endnl = '\n';

int a[400000];
int b[400000];

void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    readArray(m, b);
    sort(a, a + n, greater<>());
    ll sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }

    for(int i = 0; i<m; i++){
        int x = b[i];
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(T &f) { in >> f; }

		template<typename T>
		input_reader &operator>>(T &t) {
			read(t);
			return *this;
		}
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		template<typename T>
		inline void print(const T &x) { out << x; }

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in >> n;
		vector<int> a(n);
		in >> a;
		int m;
		in >> m;
		vector<int> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (int i : b) out << sum - a[i - 1] << '\n';
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	BDiscounts solver;
	std::istream &in(std::cin);
	std::ostream &out(std::cout);
	solver.solve(in, out);
	return 0;
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;

template<typename T>
void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) cin >> i; }
template<typename T>
void readArray(int n, T* res) { while(n--) cin >> *(res++); }
template<typename T1>
void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1>
void print(int n, T1* t1) { while(n--) cout << *(t1++) << " "; cout << "\n"; }
template<typename T1>void read(T1 &t1) { cin >> t1; }
template<typename T1, typename T2>void read(T1 &t1, T2 &t2) { cin >> t1 >> t2; }
template<typename T1, typename T2, typename T3>void read(T1 &t1, T2 &t2, T3 &t3) { cin >> t1 >> t2 >> t3; }
const char endnl = '\n';

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    while(m--){
        int x; cin >> x;
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		input_reader &operator>>(T &t) {
			read(t);
			return *this;
		}
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T, typename... Args>
		inline void print(const T &t, Args... args) {
			print(t);
			print(args...);
		}

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in >> n;
		vector<int> a(n);
		in >> a;
		int m;
		in >> m;
		vector<ll> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (ll &i : b) i = sum - a[i - 1];
		out << b;
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream &in(std::cin);
	std::ostream &out(std::cout);
	solver.solve(in, out);
	return 0;
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }
template<typename T1> inline void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1> inline void print(int n, T1* t1) { while(n--) cout << *(t1++) << " "; cout << "\n"; }
const char endnl = '\n';

int a[400000];
int b[400000];
void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    readArray(m, b);
    sort(a, a+n, greater<>());
    ll sum = accumulate(a, a+n, 0ll);

    for(int i = 0; i<m; i++){
        int x = b[i];
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;

template<typename T>
void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) cin >> i; }
template<typename T>
void readArray(int n, T* res) { while(n--) cin >> *(res++); }
template<typename T1>
void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1>
void print(int n, T1* t1) { while(n--) cout << *(t1++) << " "; cout << "\n"; }
template<typename T1>void read(T1 &t1) { cin >> t1; }
template<typename T1, typename T2>void read(T1 &t1, T2 &t2) { cin >> t1 >> t2; }
template<typename T1, typename T2, typename T3>void read(T1 &t1, T2 &t2, T3 &t3) { cin >> t1 >> t2 >> t3; }
const char endnl = '\n';

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    while(m--){
        int x; cin >> x;
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    cout.precision(17);
    solve();
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }
template <typename T> inline void printInteger(T &x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}
template <typename T> inline void print(T &x) { cout << x; }
template <typename T> inline void print(int &x) { printInteger(x); }
template <typename T> inline void print(ll &x) { printInteger(x); }
template<typename T1> inline void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1> inline void print(int n, T1* t1) { while(n--) print(*(t1++)); putchar('\n'); }
const char endnl = '\n';

int a[400000];
int b[400000];

void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    readArray(m, b);
    sort(a, a + n, greater<>());
    ll sum = accumulate(a, a + n, 0ll);

    for(int i = 0; i<m; i++){
        int x = b[i];
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define fori(i,n) for(int i = 0; i < n; i++)
#define rep(i,s,e) for(auto i = (s); i <= (e); ++i)
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for(auto &i : f) read(i); }

		template<typename T1, typename T2>
		inline void read(T1 &t1, T2 &t2) {
			read(t1);
			read(t2);
		}

		template<typename T1, typename T2, typename T3>
		inline void read(T1 &t1, T2 &t2, T3 &t3) {
			read(t1, t2);
			read(t3);
		}

		template<typename T1, typename T2, typename T3, typename T4>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4) {
			read(t1, t2, t3);
			read(t4);
		}

		template<typename T1, typename T2, typename T3, typename T4, typename T5>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5) {
			read(t1, t2, t3, t4);
			read(t5);
		}

		template<typename T>
		inline void readArray(int n, std::vector<T> &res) {
			res.resize(n);
			for (auto &i: res) read(i);
		}

		template<typename T>
		inline void readArray(int n, T *res) { while (n--) read(*(res++)); }

		template<typename T>
		input_reader& operator>>(T& t) { read(t); return *this; }
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T1>
		inline void print(const std::vector<T1> &t1) {
			bool first = true;
			for (auto &t : t1) {
				if (first) first = false;
				else print(' ');
				print(t);
			}
		}

		template<typename T, typename... Args>
		inline void print(const T& t, Args... args)
		{
			print(t);
			print(args...);
		}

		inline void println() { out.put('\n');}

		template<typename... Args>
		inline void println(Args... args)
		{
			print(args...);
			println();
		}

		template<typename T>
		output_writer& operator<<(const T& t) { print(t); return *this; }
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in >> n;
		vector<int> a(n);
		in >> a;
		int m;
		in >> m;
		vector<ll> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (ll &i : b) i = sum - a[i - 1];
		out.println(b);
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for (auto &i : f) read(i); }

		template<typename T>
		inline void read(T &f) { in >> f; }

	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T>
		inline void print(const T &x) { out << x; }

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in.read(n);
		vector<int> a(n);
		in.read(a);
		int m;
		in.read(m);
		vector<int> b(m);
		in.read(b);
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (int i : b) out << (sum - a[i - 1]) << '\n';
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	os::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream &in(std::cin);
	std::ostream &out(std::cout);
	solver.solve(in, out);
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define all(x) x.begin(), x.end()

using namespace std;

int main() {
    int n = int();

    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    int m;
    cin >> m;
    vector<int> q;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        q.push_back(x);
    }
    sort(all(a));
    long sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }

    for(auto i : q){
        cout << sum - a[n-i] << endl;
    }
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define fori(i,n) for(int i = 0; i < n; i++)
#define rep(i,s,e) for(auto i = (s); i <= (e); ++i)
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for(auto &i : f) read(i); }

		template<typename T1, typename T2>
		inline void read(T1 &t1, T2 &t2) {
			read(t1);
			read(t2);
		}

		template<typename T1, typename T2, typename T3>
		inline void read(T1 &t1, T2 &t2, T3 &t3) {
			read(t1, t2);
			read(t3);
		}

		template<typename T1, typename T2, typename T3, typename T4>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4) {
			read(t1, t2, t3);
			read(t4);
		}

		template<typename T1, typename T2, typename T3, typename T4, typename T5>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5) {
			read(t1, t2, t3, t4);
			read(t5);
		}

		template<typename T>
		inline void readArray(int n, std::vector<T> &res) {
			res.resize(n);
			for (auto &i: res) read(i);
		}

		template<typename T>
		inline void readArray(int n, T *res) { while (n--) read(*(res++)); }

		template<typename T>
		input_reader& operator>>(T& t) { read(t); return *this; }
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T1>
		inline void print(const std::vector<T1> &t1) {
			bool first = true;
			for (auto &t : t1) {
				print(t);
				if (first) first = false;
				else print(' ');
			}
		}

		template<typename T, typename... Args>
		inline void print(const T& t, Args... args)
		{
			print(t);
			print(args...);
		}

		inline void println() { out.put('\n');}

		template<typename... Args>
		inline void println(Args... args)
		{
			print(args...);
			println();
		}

		template<typename T>
		output_writer& operator<<(const T& t) { print(t); return *this; }
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in >> n;
		vector<int> a(n);
		in >> a;
		int m;
		in >> m;
		vector<ll> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (ll &i : b) i = sum - a[i - 1];
		out.println(b);
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define all(x) x.begin(), x.end()

using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    sort(all(a));
    long sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }

    int m;
    cin >> m;
    vector<int> q;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        cout << sum - a[n-x] << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define all(x) x.begin(), x.end()

using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> a;
    while(n--) {int x;cin>>x;a.push_back(x);};

    sort(all(a));

    long sum = 0;
    for (int j : a) sum += j;

    cin >> n;
    while(n--) {
        int x;
        cin >> x;
        cout << sum - a[a.size() - x] << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define all(x) x.begin(), x.end()

using namespace std;

int main() {
    int n = int();

    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    int m;
    cin >> m;
    vector<int> q;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        q.push_back(x);
    }
    sort(all(a));
    long sum = accumulate(all(a), 0L);

    for(auto i : q){
        cout << sum - a[n-i] << endl;
    }
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }

template <typename T> inline void print(const T &x) { cout << x; }
inline void print(char x) { putchar(x); }
template <typename T> inline void printIntegerHelper(T x) {
    if (x >= 10) printIntegerHelper(x/10);
    putchar(x % 10 + 48);
}
template <typename T> inline void printInteger(T x) {
    if (x < 0) putchar('-'), x=-x;
    printIntegerHelper(x);
}
inline void print(short x) { printInteger(x); }
inline void print(int x) { printInteger(x); }
inline void print(ll x) { printInteger(x); }
template<typename T1> inline void print(const vector<T1> &t1) { bool first = true; for(T1&& t:t1) { print(t); if(first) first=false, print(' '); } }
template<typename T1, typename T2> inline void print(const T1 &t1, const T2&& t2) { print(t1); print(t2); }
template<typename T1, typename T2, typename T3> inline void print(const T1 &t1, const T2& t2, const T3& t3){ print(t1,t2); print(t3); }
template<typename T1, typename T2, typename T3, typename T4> inline void print(const T1 &t1, const T2& t2, const T3& t3, const T4& t4){ print(t1,t2,t3); print(t4); }

const char endnl = '\n';

const int N = 3e5 + 5;

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    while (m--){
        int x;
        read(x);
        print(sum - a[x-1], '\n');
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }

template <typename T> inline void print(const T &x) { cout << x; }
inline void print(char x) { putchar(x); }
template <typename T> inline void printIntegerHelper(T x) {
    if (x >= 10) printIntegerHelper(x/10);
    putchar(x % 10 + 48);
}
template <typename T> inline void printInteger(T x) {
    if (x < 0) putchar('-'), x=-x;
    printIntegerHelper(x);
}
inline void print(short x) { printInteger(x); }
inline void print(int x) { printInteger(x); }
inline void print(ll x) { printInteger(x); }
template<typename T1> inline void print(const vector<T1> &t1) { bool first = true; for(T1&& t:t1) { print(t); if(first) first=false, print(' '); } }
template<typename T1, typename T2> inline void print(const T1 &t1, const T2&& t2) { print(t1); print(t2); }
template<typename T1, typename T2, typename T3> inline void print(const T1 &t1, const T2& t2, const T3& t3){ print(t1,t2); print(t3); }
template<typename T1, typename T2, typename T3, typename T4> inline void print(const T1 &t1, const T2& t2, const T3& t3, const T4& t4){ print(t1,t2,t3); print(t4); }

const char endnl = '\n';

const int N = 3e5 + 5;

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    vector<ll> q;
    readArray(m, q);
    for (auto &x : q) {
        x = sum - a[x-1];
    }
    print(q);
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;

template<typename T>
void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) cin >> i; }
template<typename T>
void readArray(int n, T* res) { while(n--) cin >> *(res++); }
template<typename T1>
void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1>
void print(int n, T1* t1) { while(n--) cout << *(t1++) << " "; cout << "\n"; }
template<typename T1>void read(T1 &t1) { cin >> t1; }
template<typename T1, typename T2>void read(T1 &t1, T2 &t2) { cin >> t1 >> t2; }
template<typename T1, typename T2, typename T3>void read(T1 &t1, T2 &t2, T3 &t3) { cin >> t1 >> t2 >> t3; }
const char endnl = '\n';
int a[400000];
int b[400000];
void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    readArray(m, b);
    sort(a, a+n, greater<>());
    ll sum = accumulate(a, a+n, 0ll);

    for(int i = 0; i<m; i++){
        int x = b[i];
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

template <typename T, typename L>
T sum(L &list){T sum = T(); for(auto &x : list) sum += x; return sum;}
long sum(vector<short> &list){return sum<long, vector<short>>(list);}
long sum(vector<int> &list){return sum<long, vector<int>>(list);}
long sum(vector<long> &list){return sum<long, vector<long>>(list);}
float sum(vector<float> &list){return sum<float, vector<float>>(list);}
double sum(vector<double> &list){return sum<double, vector<double>>(list);}

int main() {
    int n = int();

    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    int m;
    cin >> m;
    vector<int> q;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        q.push_back(x);
    }
    sort(a.begin(),a.end());
    long sumV = sum(a);

    for(auto i : q){
        cout << sumV - a[n-i] << endl;
    }
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;

template<typename T>
void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) cin >> i; }
template<typename T>
void readArray(int n, T* res) { while(n--) cin >> *(res++); }
template<typename T1>
void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1>
void print(int n, T1* t1) { while(n--) cout << *(t1++) << " "; cout << "\n"; }
template<typename T1>void read(T1 &t1) { cin >> t1; }
template<typename T1, typename T2>void read(T1 &t1, T2 &t2) { cin >> t1 >> t2; }
template<typename T1, typename T2, typename T3>void read(T1 &t1, T2 &t2, T3 &t3) { cin >> t1 >> t2 >> t3; }
const char endnl = '\n';
int a[400000];
void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    sort(a, a+n, greater<>());
    ll sum = accumulate(a, a+n, 0ll);
    while(m--){
        int x; cin >> x;
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define fori(i,n) for(int i = 0; i < n; i++)
#define rep(i,s,e) for(auto i = (s); i <= (e); ++i)
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for(auto &i : f) read(i); }

		template<typename T1, typename T2>
		inline void read(T1 &t1, T2 &t2) {
			read(t1);
			read(t2);
		}

		template<typename T1, typename T2, typename T3>
		inline void read(T1 &t1, T2 &t2, T3 &t3) {
			read(t1, t2);
			read(t3);
		}

		template<typename T1, typename T2, typename T3, typename T4>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4) {
			read(t1, t2, t3);
			read(t4);
		}

		template<typename T1, typename T2, typename T3, typename T4, typename T5>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5) {
			read(t1, t2, t3, t4);
			read(t5);
		}

		template<typename T>
		inline void readArray(int n, std::vector<T> &res) {
			res.resize(n);
			for (auto &i: res) read(i);
		}

		template<typename T>
		inline void readArray(int n, T *res) { while (n--) read(*(res++)); }

		template<typename T>
		input_reader& operator>>(T& t) { read(t); return *this; }
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T1>
		inline void print(const std::vector<T1> &t1) {
			bool first = true;
			for (auto &t : t1) {
				print(t);
				if (first) first = false, print(' ');
			}
		}

		template<typename T, typename... Args>
		inline void print(const T& t, Args... args)
		{
			print(t);
			print(args...);
		}

		inline void println() { out.put('\n');}

		template<typename... Args>
		inline void println(Args... args)
		{
			print(args...);
			println();
		}

		template<typename T>
		output_writer& operator<<(const T& t) { print(t); return *this; }
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in >> n;
		vector<int> a(n);
		in >> a;
		int m;
		in >> m;
		vector<ll> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (ll &i : b) i = sum - a[i - 1];
		out.println(b);
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;

template<typename T>
void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) cin >> i; }
template<typename T>
void readArray(int n, T* res) { while(n--) cin >> *(res++); }
template<typename T1>
void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1>
void print(int n, T1* t1) { while(n--) cout << *(t1++) << " "; cout << "\n"; }
template<typename T1>void read(T1 &t1) { cin >> t1; }
template<typename T1, typename T2>void read(T1 &t1, T2 &t2) { cin >> t1 >> t2; }
template<typename T1, typename T2, typename T3>void read(T1 &t1, T2 &t2, T3 &t3) { cin >> t1 >> t2 >> t3; }
const char endnl = '\n';
int a[400000];
int b[400000];
void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    readArray(m, b);
    sort(a, a+n, greater<>());
    ll sum = accumulate(a, a+n, 0ll);

    for(int x: b){
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }

template <typename T> inline void print(const T &x) { cout << x; }
inline void print(char x) { putchar(x); }
template <typename T> inline void printInteger(T x) {
    do {
        if (x < 0) putchar('-'), x = -x;
        if (x < 10) putchar(x + 48);
        else x/=10, putchar(x % 10 + 48);
    } while(x!=0);
}
inline void print(short x) { printInteger(x); }
inline void print(int x) { printInteger(x); }
inline void print(ll &x) { printInteger(x); }
template<typename T1> inline void print(const vector<T1> &t1) { for(T1&& t:t1) { print(t); print(' '); } }
template<typename T1, typename T2> inline void print(const T1 &t1, const T2&& t2) { print(t1); print(t2); }
template<typename T1, typename T2, typename T3> inline void print(const T1 &t1, const T2& t2, const T3& t3){ print(t1,t2); print(t3); }
template<typename T1, typename T2, typename T3, typename T4> inline void print(const T1 &t1, const T2& t2, const T3& t3, const T4& t4){ print(t1,t2,t3); print(t4); }

const char endnl = '\n';

const int N = 3e5 + 5;

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    while (m--){
        int x;
        read(x);
        print(sum - a[x-1], '\n');
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }
template <typename T> inline void printInteger(T &x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}
template <typename T> inline void print(T &x) { cout << x; }
template <typename T> inline void print(int &x) { printInteger(x); }
template <typename T> inline void print(ll &x) { printInteger(x); }
template<typename T1> inline void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1> inline void print(int n, T1* t1) { while(n--) print(*(t1++)); putchar('\n'); }
const char endnl = '\n';

const int N = 3e5 + 5;
int a[N];

void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    sort(a, a + n, greater<>());
    ll sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }
    while (m--){
        int x;
        read(x);
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for (auto &i : f) read(i); }

		template<typename T>
		inline void read(T &f) { in >> f; }

	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T>
		inline void print(const T &x) { out << x; }

		template<typename T, typename... Args>
		inline void print(const T &t, Args... args) {
			print(t);
			print(args...);
		}

		inline void println() { out.put('\n'); }

		template<typename... Args>
		inline void println(Args... args) {
			print(args...);
			println();
		}
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in.read(n);
		vector<int> a(n);
		in.read(a);
		int m;
		in.read(m);
		vector<ll> b(m);
		in.read(b);
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (ll &i : b) i = sum - a[i - 1];
		out.println(b);
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream &in(std::cin);
	std::ostream &out(std::cout);
	solver.solve(in, out);
	return 0;
}


#include <bits/stdc++.h>
#define Fast_cin ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
#define DEBUG(x) cerr << "DEBUG" << x << " >>> " << endl;
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') fu = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

const int N = 3e5 + 5;

int a[N];
ll sum;
int n, m;

int main() {
    read(n);
    for(register int i = 1; i <= n; i++) read(a[i]), sum += a[i];
    sort(a + 1, a + n + 1);
    read(m);
    for(register int i = 1; i <= m; i++) {
        int t; read(t);
        print(sum - a[n - t + 1], '\n');
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define all(x) x.begin(), x.end()

using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    sort(all(a));
    long sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }

    int m;
    cin >> m;
    vector<int> q;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        cout << sum - a[n-x] << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define fori(i,n) for(int i = 0; i < n; i++)
#define rep(i,s,e) for(auto i = (s); i <= (e); ++i)
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(char &f) { in.get(f); }

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(short &f) { readIntegerValue(f); }

		inline void read(long int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		inline void read(unsigned int &f) { readIntegerValue(f); }

		inline void read(unsigned short &f) { readIntegerValue(f); }

		inline void read(unsigned long int &f) { readIntegerValue(f); }

		inline void read(unsigned long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for (auto &i : f) read(i); }

		template<typename T>
		inline void read(T &f) { in >> f; }

		template<typename T1, typename T2>
		inline void read(T1 &t1, T2 &t2) {
			read(t1);
			read(t2);
		}

		template<typename T1, typename T2, typename T3>
		inline void read(T1 &t1, T2 &t2, T3 &t3) {
			read(t1, t2);
			read(t3);
		}

		template<typename T1, typename T2, typename T3, typename T4>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4) {
			read(t1, t2, t3);
			read(t4);
		}

		template<typename T1, typename T2, typename T3, typename T4, typename T5>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5) {
			read(t1, t2, t3, t4);
			read(t5);
		}

		template<typename T>
		inline void readArray(int n, std::vector<T> &res) {
			res.resize(n);
			for (auto &i: res) read(i);
		}

		template<typename T>
		inline void readArray(int n, T *res) { while (n--) read(*(res++)); }

		template<typename T>
		input_reader &operator>>(T &t) {
			read(t);
			return *this;
		}
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void flush() { out.flush(); }

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		inline void print(unsigned short x) { printInteger(x); }

		inline void print(unsigned int x) { printInteger(x); }

		inline void print(unsigned long int x) { printInteger(x); }

		inline void print(unsigned long long int x) { printInteger(x); }

		template<typename T1>
		inline void print(const T1 &t1) {
			out << t1;
		}

		template<typename T1>
		inline void print(const std::vector<T1> &t1) {
			bool first = true;
			for (auto &t : t1) {
				if (first) first = false;
				else print(' ');
				print(t);
			}
		}

		template<typename T, typename... Args>
		inline void print(const T &t, Args... args) {
			print(t);
			print(args...);
		}

		inline void println() { out.put('\n'); }

		template<typename... Args>
		inline void println(Args... args) {
			print(args...);
			println();
		}

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}

namespace matrix {

template<typename T>
class matrix2d {
private:
	const size_t number_of_rows, number_of_cols;
    std::vector<T> M;
	inline size_t index(int i, int j) { return i * number_of_cols + j; }
public:
	matrix2d(size_t rows, size_t cols) : number_of_rows(rows), number_of_cols(cols) {
		M.resize(rows * cols);
	}

	void fill(T t){
		std::fill(M.begin(), M.end(), t);
	}

	inline T& operator()(int i, int j) { return M[index(i,j)]; }
	inline const T& operator()(int i, int j) const { return M[index(i,j)]; }

	inline size_t rows() {return number_of_rows; }
	inline size_t cols() {return number_of_cols; }
	typename std::vector<T>::iterator begin() {return M.begin();}
	typename std::vector<T>::const_iterator begin() const {return M.begin();}
	typename std::vector<T>::iterator end() {return M.end();}
	typename std::vector<T>::const_iterator end() const {return M.end();}

};

}

using namespace matrix;
using namespace std;

class CPaintingTheFence {

	void solve(io::input_reader in, io::output_writer out) {
		size_t n,q;
		in.read(n,q);
		matrix2d<int> mat(q,q);
		vector<int> me(q);

		vector<vector<int>> v(n + 1);
		fori(i,q){
			int l,r;
			in >>l>>r;
			rep(j,l,r) v[j].push_back(i);
		}
		int sum = 0;
		for(auto & i: v) if(!i.empty()) sum ++;
		for(auto&i:v) if(i.size()==1) me[i[0]]++; else if(i.size()==2) mat(i[0], i[1])++;
		int best = 0;
		fori(i,q) rep(j,i+1,q-1) best = max(best, sum - me[i] - me[j] - mat(i,j));
		out << best;
	}
public:
	void solve(std::istream& in, std::ostream& out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	CPaintingTheFence solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }

template <typename T> inline void print(const T &x) { cout << x; }
inline void print(char x) { putchar(x); }
template <typename T> inline void printIntegerHelper(T x) {
    if (x >= 10) printIntegerHelper(x/10);
    putchar(x % 10 + 48);
}
template <typename T> inline void printInteger(T x) {
    if (x < 0) putchar('-'), x=-x;
    printIntegerHelper(x);
}
inline void print(short x) { printInteger(x); }
inline void print(int x) { printInteger(x); }
inline void print(ll x) { printInteger(x); }
template<typename T1> inline void print(const vector<T1> &t1) { bool first = true; for(auto& t : t1) { print(t); if(first) first=false, print(' '); } }
template<typename T1, typename T2> inline void print(const T1 &t1, const T2&& t2) { print(t1); print(t2); }
template<typename T1, typename T2, typename T3> inline void print(const T1 &t1, const T2& t2, const T3& t3){ print(t1,t2); print(t3); }
template<typename T1, typename T2, typename T3, typename T4> inline void print(const T1 &t1, const T2& t2, const T3& t3, const T4& t4){ print(t1,t2,t3); print(t4); }

const char endnl = '\n';

const int N = 3e5 + 5;

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    vector<ll> q;
    readArray(m, q);
    for (auto &x : q) {
        x = sum - a[x-1];
    }
    print(q);
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define all(x) x.begin(), x.end()

using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    sort(all(a));
    long sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }

    int m;
    cin >> m;
    vector<int> q;
    for (int i = 0; i < m; ++i) {
        cout << sum - a[n-i] << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }

template <typename T> inline void print(const T &x) { cout << x; }
inline void print(char x) { putchar(x); }
template <typename T> inline void printIntegerHelper(T x) {
    if (x >= 10) printIntegerHelper(x/10);
    putchar(x % 10 + 48);
}
template <typename T> inline void printInteger(T x) {
    if (x < 0) putchar('-'), x=-x;
    printIntegerHelper(x);
}
inline void print(short x) { printInteger(x); }
inline void print(int x) { printInteger(x); }
inline void print(ll x) { printInteger(x); }
template<typename T1> inline void print(const vector<T1> &t1) { bool first = true; for(T1&& t:t1) { print(t); if(first) first=false, print(' '); } }
template<typename T1, typename T2> inline void print(const T1 &t1, const T2&& t2) { print(t1); print(t2); }
template<typename T1, typename T2, typename T3> inline void print(const T1 &t1, const T2& t2, const T3& t3){ print(t1,t2); print(t3); }
template<typename T1, typename T2, typename T3, typename T4> inline void print(const T1 &t1, const T2& t2, const T3& t3, const T4& t4){ print(t1,t2,t3); print(t4); }

const char endnl = '\n';

const int N = 3e5 + 5;

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    vector<int> q;
    readArray(m, q);
    for (auto x : q){
        print(sum - a[x-1], '\n');
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for (auto &i : f) read(i); }

		template<typename T>
		inline void read(T &f) { in >> f; }

	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T>
		inline void print(const T &x) { out << x; }

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in.read(n);
		vector<int> a(n);
		in.read(a);
		int m;
		in.read(m);
		vector<int> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (int i : b) out << (sum - a[i - 1]) << '\n';
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream &in(std::cin);
	std::ostream &out(std::cout);
	solver.solve(in, out);
	return 0;
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;
template<typename T> inline void readIntegerValue(T& f) {
    bool positive = true;
    f = 0; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') positive = false; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    if(!positive) f *= -1;
}
inline void read(int& f) { readIntegerValue(f); }
inline void read(ll& f) { readIntegerValue(f); }
template<typename T> inline void read(T& f) { cin >> f; }
template<typename T1, typename T2> inline void read(T1 &t1, T2 &t2) { read(t1); read(t2); }
template<typename T1, typename T2, typename T3> inline void read(T1 &t1, T2 &t2, T3 &t3) { read(t1,t2); read(t3); }

template<typename T> inline void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) read(i); }
template<typename T> inline void readArray(int n, T* res) { while(n--) read(*(res++)); }
template <typename T> inline void printInteger(T &x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}
template <typename T> inline void print(T &x) { cout << x; }
template <typename T> inline void print(int &x) { printInteger(x); }
template <typename T> inline void print(ll &x) { printInteger(x); }
template<typename T1> inline void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1> inline void print(int n, T1* t1) { while(n--) print(*(t1++)); putchar('\n'); }
const char endnl = '\n';

int a[400000];

void solve() {
    int n; read(n);
    readArray(n, a);
    int m; read(m);
    sort(a, a + n, greater<>());
    ll sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }
    while (m--){
        int x;
        read(x);
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cout.precision(17);
    solve();
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define all(x) x.begin(), x.end()

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n = int();

    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    int m;
    cin >> m;
    vector<int> q;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        q.push_back(x);
    }
    sort(all(a));
    long sum = 0;
    for (int j = 0; j < n; ++j) {
        sum += a[j];
    }

    for(auto i : q){
        cout << sum - a[n-i] << '\n';
    }
}


#pragma GCC optimize("O3")
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

#define all(x) (x).begin(), (x).end()
#define ll long long int

using namespace std;

template<typename T>
void readArray(int n, vector<T> &res) { res.resize(n); for(auto &i: res) cin >> i; }
template<typename T>
void readArray(int n, T* res) { while(n--) cin >> *(res++); }
template<typename T1>
void print(vector<T1> &t1) { for(T1& t:t1) cout << t << " "; cout << "\n"; }
template<typename T1>
void print(int n, T1* t1) { while(n--) cout << *(t1++) << " "; cout << "\n"; }
template<typename T1>void read(T1 &t1) { cin >> t1; }
template<typename T1, typename T2>void read(T1 &t1, T2 &t2) { cin >> t1 >> t2; }
template<typename T1, typename T2, typename T3>void read(T1 &t1, T2 &t2, T3 &t3) { cin >> t1 >> t2 >> t3; }
const char endnl = '\n';

void solve() {
    int n; read(n);
    vector<int> a;
    readArray(n, a);
    int m; read(m);
    sort(all(a), greater<>());
    ll sum = accumulate(all(a), 0ll);
    while(m--){
        int x; cin >> x;
        cout << sum - a[x-1] << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(17);
    solve();
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		//		template<typename T>
//		inline void read(T &f) { in >> f; }

		template<typename T>
		input_reader &operator>>(T &t) {
			read(t);
			return *this;
		}
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T>
		inline void print(const T &x) { out << x; }

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in >> n;
		vector<int> a(n);
		in >> a;
		int m;
		in >> m;
		vector<int> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (int i : b) out << (sum - a[i - 1]) << '\n';
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	os::sync_with_stdio(false), cin.tie(0);
	BDiscounts solver;
	std::istream &in(std::cin);
	std::ostream &out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(auto i = (s); i <= (e); ++i)
#define ll long long int

namespace io {
	class input_reader {
		std::istream ∈

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(T &f) { in >> f; }

		template<typename T>
		inline void read(std::vector<T> &f) { for (auto &i : f) read(i); }

		template<typename T1, typename T2>
		inline void read(T1 &t1, T2 &t2) {
			read(t1);
			read(t2);
		}

		template<typename T1, typename T2, typename T3>
		inline void read(T1 &t1, T2 &t2, T3 &t3) {
			read(t1, t2);
			read(t3);
		}

		template<typename T1, typename T2, typename T3, typename T4>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4) {
			read(t1, t2, t3);
			read(t4);
		}

		template<typename T1, typename T2, typename T3, typename T4, typename T5>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5) {
			read(t1, t2, t3, t4);
			read(t5);
		}

		template<typename T>
		inline void readArray(int n, std::vector<T> &res) {
			res.resize(n);
			for (auto &i: res) read(i);
		}

		template<typename T>
		inline void readArray(int n, T *res) { while (n--) read(*(res++)); }

		template<typename T>
		input_reader &operator>>(T &t) {
			read(t);
			return *this;
		}
	};
}

namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		template<typename T>
		inline void print(const T &x) { out << x; }

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		template<typename T1>
		inline void print(const std::vector<T1> &t1) {
			bool first = true;
			for (auto &t : t1) {
				print(t);
				if (first) first = false, print(' ');
			}
		}

		template<typename T1, typename T2>
		inline void print(const T1 &t1, const T2 &t2) {
			print(t1);
			print(t2);
		}

		template<typename T1, typename T2, typename T3>
		inline void print(const T1 &t1, const T2 &t2, const T3 &t3) {
			print(t1, t2);
			print(t3);
		}

		template<typename T1, typename T2, typename T3, typename T4>
		inline void print(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4) {
			print(t1, t2, t3);
			print(t4);
		}

		template<typename T1, typename T2, typename T3, typename T4, typename T5>
		inline void print(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5) {
			print(t1, t2, t3, t4);
			print(t5);
		}

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}

using namespace std;

class BDiscounts {
	void solve(io::input_reader in, io::output_writer out) {
		int n;
		in >> n;
		vector<int> a(n);
		in >> a;
		int m;
		in >> m;
		vector<int> b(m);
		in >> b;
		sort(all(a), [](auto a, auto b) { return a > b; });
		ll sum = accumulate(all(a), 0ll);
		for (int i : b) out << sum - a[i - 1] << '\n';
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		solve(io::input_reader(in), io::output_writer(out));
	}
};

int main() {
	BDiscounts solver;
	std::istream &in(std::cin);
	std::ostream &out(std::cout);
	solver.solve(in, out);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
      long long n;
      cin>>n;
      long long a[n];
      long long sum=0;
      for(long long i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
      }
      long long m;
      cin>>m;
      long long b[m];
      for(long long i=0;i<m;i++){
            cin>>b[i];
      }
      sort(a,a+n,greater<long long>());
      for(long long i=0;i<m;i++){
            cout<<sum-a[b[i]-1]<<endl;
      }
      /*for(int i=0;i<m;i++){
            int sum=0;
            for(int j=0;j<(b[i]-1);j++){
                  sum+=a[j];
            }
            for(int j=b[i];j<n;j++){
                  sum+=a[j];
            }
            cout<<sum<<endl;
      }*/

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
      int n;
      cin>>n;
      int a[n];
      int sum=0;
      for(int i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
      }
      int m;
      cin>>m;
      int b[m];
      for(int i=0;i<m;i++){
            cin>>b[i];
      }
      sort(a,a+n,greater<int>());
      for(int i=0;i<m;i++){
            cout<<sum-a[b[i]-1]<<endl;
      }
      /*for(int i=0;i<m;i++){
            int sum=0;
            for(int j=0;j<(b[i]-1);j++){
                  sum+=a[j];
            }
            for(int j=b[i];j<n;j++){
                  sum+=a[j];
            }
            cout<<sum<<endl;
      }*/

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
      int n;
      cin>>n;
      int a[n];
      for(int i=0;i<n;i++){
            cin>>a[i];
      }
      int m;
      cin>>m;
      int b[m];
      for(int i=0;i<m;i++){
            cin>>b[i];
      }
      sort(a,a+n,greater<int>());
      for(int i=0;i<m;i++){
            int sum=0;
            for(int j=0;j<(b[i]-1);j++){
                  sum+=a[j];
            }
            for(int j=b[i];j<n;j++){
                  sum+=a[j];
            }
            cout<<sum<<endl;
      }

}