#include <bits/stdc++.h>
using namespace std;
int a[300005];
int main() {
  int n;
  scanf("%d", &n);
  int i;
  long long sum2 = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum2 += a[i];
  }
  sort(a + 1, a + n + 1);
  int sum1;
  scanf("%d", &sum1);
  while (sum1 > 0) {
    int num;
    scanf("%d", &num);
    printf("%lld\n", sum2 - a[n - num + 1]);
    sum1--;
  }
}
