#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int n;
  cin >> n;
  long long int a[n];
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  long long int q;
  sort(a, a + n);
  cin >> q;
  while (q--) {
    long long int g;
    cin >> g;
    cout << sum - a[n - g] << endl;
  }
}
