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