#include <bits/stdc++.h>
using namespace std;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const long long LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long n, m;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  cin >> m;
  vector<long long> q(m);
  for (int i = 0; i < m; ++i) {
    cin >> q[i];
  }
  vector<long long> sum(n + 1, 0);
  for (int i = 0; i < n; ++i) {
    sum[i + 1] = sum[i] + a[i];
  }
  sort((a).begin(), (a).end(), greater<long long>());
  for (int i = 0; i < m; ++i) {
    long long ans = sum[n] - a[q[i] - 1];
    cout << ans << endl;
  }
  return 0;
}
