#include <bits/stdc++.h>
using namespace std;
int compare(const void* a, const void* b) {
  const int* x = (int*)a;
  const int* y = (int*)b;
  if (*x < *y)
    return 1;
  else if (*x > *y)
    return -1;
  return 0;
}
int main() {
  long int n;
  cin >> n;
  long long sum = 0;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum = sum + a[i];
  }
  qsort(a, n, sizeof(long long), compare);
  long int m;
  cin >> m;
  while (m--) {
    long int b;
    cin >> b;
    cout << sum - a[b - 1] << endl;
  }
}
