#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n;
  vector<int> a(n);
  long long sum = 0;
  for (auto& i : a) {
    cin >> i;
    sum += i;
  }
  sort(a.begin(), a.end());
  cin >> m;
  while (m--) {
    int q;
    cin >> q;
    long long cnt = sum;
    cnt -= a[n - q];
    cout << cnt << '\n';
  }
}
