#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long n, sum = 0;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  sort(v.begin(), v.end(), greater<long long>());
  long long m;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    long long x, temp;
    cin >> x;
    temp = sum;
    temp -= v[x - 1];
    cout << temp << endl;
  }
}
