#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int a[maxn];
int b[maxn];
int n, m;
bool cmp(int x1, int x2) { return x1 > x2; }
int main() {
  cin >> n;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  cin >> m;
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
    printf("%lld\n", sum - a[b[i]]);
  }
  return 0;
}
