#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 3e5 + 5;
const int mod = 1e9 + 7;
const double eps = 1e-8;
int a[N];
int b[N];
int main() {
  int n, m;
  scanf("%d", &n);
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  sort(a + 1, a + 1 + n);
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    long long ans = sum;
    int te;
    scanf("%d", &te);
    ans -= a[n - te + 1];
    printf("%lld\n", ans);
  }
  return 0;
}
