#include <bits/stdc++.h>
using namespace std;
const int inf_int = 1e9 + 100;
const long long inf_ll = 8e18;
const double pi = 3.1415926535898;
bool debug = 0;
const int MAXN = 3e5 + 100;
const int LOG = 23;
const int mod = 1e9 + 7;
const int MX = MAXN + 100;
const long long MOD = 1000000000949747713ll;
int a[MAXN];
void solve() {
  int n;
  cin >> n;
  long long sum = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a + 1, a + n + 1);
  int m;
  cin >> m;
  for (int j = 1; j <= m; ++j) {
    int q;
    cin >> q;
    cout << sum - a[n - q + 1] << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  int t = 1;
  while (t--) solve();
  return 0;
}
