#include <bits/stdc++.h>
using namespace std;
long long a[300010];
long long N, M;
int main() {
  cin >> N;
  for (long long i = 0; i < N; i++) cin >> a[i];
  cin >> M;
  sort(a, a + N);
  long long tot = 0;
  for (long long i = 0; i < N; i++) tot += a[i];
  for (long long i = 0; i < M; i++) {
    long long b;
    cin >> b;
    cout << tot - a[N - b] << endl;
  }
  return 0;
}
