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