#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<int> c;
  vector<int> i;
  cin >> n;
  int temp;
  long long sum = 0;
  for (int j = 0; j < n; j++) {
    cin >> temp;
    c.push_back(temp);
    sum += temp;
  }
  cin >> m;
  for (int j = 0; j < m; j++) {
    cin >> temp;
    i.push_back(temp);
  }
  sort(c.rbegin(), c.rend());
  for (int j = 0; j < m; j++) {
    cout << sum - c[i[j] - 1] << endl;
  }
  return 0;
}
