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