#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long mas[n];
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> mas[i];
    sum += mas[i];
  }
  sort(mas, mas + n);
  int k;
  cin >> k;
  int c;
  while (k > 0) {
    cin >> c;
    cout << sum - mas[n - c] << endl;
    k--;
  }
}
