#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, val, sum = 0;
  cin >> n;
  vector<long long> v, q;
  for (long long i = 0; i < n; i++) {
    cin >> val;
    v.push_back(val);
    sum += val;
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> val;
    cout << sum - v[val - 1] << endl;
  }
  return 0;
}
