#include <bits/stdc++.h>
using namespace std;
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
long long arr[300005];
long long cell[300005];
int main() {
  long long n;
  cin >> n;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  sort(arr + 1, arr + n + 1);
  long long m;
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> cell[i];
  for (int i = 1; i <= m; i++) {
    long long d = cell[i];
    cout << sum - arr[n - d + 1] << '\n';
  }
}
