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