#include <bits/stdc++.h>
using namespace std;
unsigned long long vecSum(const vector<unsigned long long> &vec) {
  unsigned long long sum = 0;
  for (unsigned long long i = 0; i < vec.size(); i++) {
    sum += vec[i];
  }
  return sum;
}
int main() {
  unsigned long long nk, qk;
  unsigned long long nn, qq;
  unsigned long long vSum;
  vector<unsigned long long> n;
  vector<unsigned long long> q;
  cin >> nk;
  for (unsigned long long i = 0; i < nk; i++) {
    cin >> nn;
    n.push_back(nn);
  }
  vSum = vecSum(n);
  sort(n.begin(), n.end());
  cin >> qk;
  for (unsigned long long i = 0; i < qk; i++) {
    cin >> qq;
    q.push_back(qq);
  }
  for (unsigned long long i = 0; i < qk; i++) {
    cout << vSum - n[nk - q[i]] << endl;
  }
  return 0;
}
