#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int a[MAXN];
int main() {
  int n, m;
  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, greater<int>());
  scanf("%d", &m);
  for (int i = 0, r; i < m; ++i)
    scanf("%d", &r), printf("%lld\n", sum - a[r - 1]);
  return 0;
}
