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