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