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