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