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