#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long MAX = 300005;
bool prime[MAX];
void sieve() {
  memset(prime, true, sizeof(prime));
  prime[0] = prime[1] = false;
  for (long long p = 2; p * p <= MAX; p++) {
    if (prime[p] == true) {
      for (long long i = p * 2; i <= MAX; i += p) prime[i] = false;
    }
  }
}
long long power(long long a, long long b, long long m) {
  if (b == 0) return 1;
  if (b == 1) return a % m;
  long long t = power(a, b / 2, m);
  t = (t * t) % m;
  if (b & 1) t = (t * a) % m;
  return t;
}
long long modInverse(long long a, long long m) { return power(a, m - 2, m); }
long long __gcd(long long a, long long b) {
  if (b == 0) return a;
  return __gcd(b, a % b);
}
bool cmp(const pair<long long, long long> &l,
         const pair<long long, long long> &r) {
  return l.first < r.first;
}
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long sum = accumulate(a, a + n, 0LL);
  sort(a, a + n);
  long long q;
  cin >> q;
  long long mn = LLONG_MAX;
  while (q--) {
    long long x;
    cin >> x;
    long long p = a[n - x];
    cout << sum - p << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long t;
  t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}
