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