#include <bits/stdc++.h>
using namespace std;
long long n, a[3000001], sum, q, m;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a + 1, a + 1 + n);
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> q;
    cout << sum - a[n - q + 1] << " ";
  }
}
