#include <bits/stdc++.h>
using namespace std;
struct choc {
  long long index;
  long long price;
};
bool cmp(struct choc choc1, struct choc choc2) {
  return choc1.price > choc2.price;
}
vector<choc> chocList;
int main() {
  long long n, m, sum = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    sum += temp;
    struct choc tempC = {i + 1, temp};
    chocList.push_back(tempC);
  }
  sort(chocList.begin(), chocList.end(), cmp);
  cin >> m;
  for (long long i = 0; i < m; i++) {
    long long temp;
    cin >> temp;
    cout << sum - chocList[temp - 1].price << endl;
  }
  return 0;
}
