#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
bool visited[N];
const long long inf = 1e9;
const long double eps = 1e-9;
const long double pi = acos(-1);
const long long mod = 1000000007;
long long a[N], sum[N];
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
void solve() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  long long val = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  int q;
  cin >> q;
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; i++) {
    val += a[i];
    sum[i] = val;
  }
  while (q--) {
    int n_coup;
    cin >> n_coup;
    n_coup--;
    cout << val - a[n_coup] << '\n';
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
