#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000 + 10;
int a[maxn];
int n, m;
int main() {
  long long sum = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  sort(a, a + n);
  scanf("%d", &m);
  int x;
  while (m--) {
    scanf("%d", &x);
    printf("%lld\n", sum - a[n - x]);
  }
  return 0;
}
