#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  unsigned long long sum = 0;
  int sopt, m;
  cin >> sopt;
  int *arr = new int[sopt];
  for (int i = 0; i < sopt; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  sort(arr, arr + sopt);
  cin >> m;
  int *arra = new int[m];
  for (int c = 0; c < m; c++) {
    cin >> arra[c];
    cout << sum - arr[sopt - arra[c]] << endl;
  }
  return 0;
}
