#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool prime[10000];
void sieve() {
  for (int p = 2; p * p <= 10000; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= 10000; i += p) prime[i] = false;
    }
  }
}
int main() {
  int n;
  cin >> n;
  long long a[n + 5], sum = 0;
  for (int i = 0; i < n; i++) cin >> a[i], sum += a[i];
  sort(a, a + n);
  int m;
  cin >> m;
  while (m--) {
    int x;
    cin >> x;
    long long ans = sum - a[n - x];
    cout << ans << endl;
  }
}
