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