#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  long long int s = 0;
  scanf("%lld", &n);
  long long int ar[n];
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &ar[i]);
    s += ar[i];
  }
  sort(ar, ar + n, greater<long long int>());
  long long int c;
  scanf("%lld", &c);
  long long int arr[c];
  for (long long int i = 0; i < c; i++) {
    scanf("%lld", &arr[i]);
    printf("%lld\n", s - ar[arr[i] - 1]);
  }
  return 0;
}
