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