#include <bits/stdc++.h>
using namespace std;
long long n, m, sm, a[300001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sm += a[i];
  }
  cin >> m;
  sort(a + 1, a + 1 + n, greater<int>());
  while (m--) {
    int x;
    cin >> x;
    cout << sm - a[x] << endl;
  }
  return 0;
}
