#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, x, sum = 0;
  vector<long long int> ch;
  cin >> n;
  for (long long int j = 0; j < n; j++) {
    cin >> x;
    ch.push_back(x);
    sum += x;
  }
  sort(ch.begin(), ch.end());
  cin >> m;
  long long int q[m];
  for (long long int j = 0; j < m; j++) {
    cin >> q[j];
  }
  for (long long int j = 0; j < m; j++) {
    cout << sum - ch[n - q[j]] << endl;
  }
  return 0;
}
