#include <bits/stdc++.h>
using namespace std;
bool comp(const int &a, const int &b) {
  if (a > b) return true;
  return false;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  long long key = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    key += a[i];
  }
  sort(a.begin(), a.end(), comp);
  long long m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    long long trap;
    cin >> trap;
    cout << key - a[trap - 1] << endl;
  }
}
