#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int TESTS, n, m, k, i, j, a, b, r, c, l, u, uu, d, e, f, g, h;
  TESTS = 1;
  while (TESTS--) {
    cin >> n;
    long long int sum = 0;
    long long int arr[n];
    for (long long int i = 0; i <= n - 1; i++) {
      cin >> arr[i];
      sum += arr[i];
    }
    sort(arr, arr + n);
    cin >> m;
    for (long long int i = 0; i <= m - 1; i++) {
      cin >> a;
      cout << sum - arr[n - a] << "\n";
    }
  }
  return 0;
}
