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