#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, *a, q, sum = 0;
  cin >> n;
  a = new long long int[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n);
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> q;
    cout << sum - a[n - q] << "\n";
  }
  return 0;
}
