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