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