#include <bits/stdc++.h>
using namespace std;
long long a[300001], q[300001];
int main() {
  long long n, m;
  cin >> n;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n, greater<int>());
  cin >> 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;
  }
  return 0;
}
