#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long values[n];
  long long total = 0;
  for (long long i = 0; i < n; i++) {
    cin >> values[i];
    total += values[i];
  }
  sort(values, values + n);
  long long m, dis;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> dis;
    cout << total - values[n - dis] << endl;
  }
}
