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