#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long a[312345], q[312345];
long long sum;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a + 1, a + n + 1);
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> q[i];
    cout << sum - a[n - q[i] + 1] << '\n';
  }
  return 0;
}
