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