#include <bits/stdc++.h>
using namespace std;
vector<long long int> a, q;
vector<long long int>::iterator i;
int main() {
  int n, m;
  long long int s = 0;
  cin >> n;
  a.resize(n);
  for (auto i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  cin >> m;
  q.resize(m);
  for (auto i = 0; i < m; i++) cin >> q[i];
  sort(a.begin(), a.end());
  for (auto i = 0; i < m; i++) cout << s - a[n - q[i]] << "\n";
  return 0;
}
