#include <bits/stdc++.h>
using namespace std;
int arr[3 * 100001];
void mergesort(int arr[], int l, int m, int h) {
  int n1 = m - l + 1;
  int n2 = h - m;
  int a1[n1];
  int a2[n2];
  for (int i = 0; i < n1; i++) a1[i] = arr[l + i];
  for (int i = 0; i < n2; i++) a2[i] = arr[m + 1 + i];
  int i = 0;
  int j = 0;
  int k = l;
  while (i < n1 && j < n2) {
    if (a1[i] <= a2[j]) {
      arr[k] = a1[i];
      i++;
    } else {
      arr[k] = a2[j];
      j++;
    }
    k++;
  }
  while (i < n1) {
    arr[k] = a1[i];
    i++;
    k++;
  }
  while (j < n2) {
    arr[k] = a2[j];
    j++;
    k++;
  }
}
void merge(int arr[], int l, int h) {
  if (h > l) {
    int m = (l + h) / 2;
    merge(arr, l, m);
    merge(arr, m + 1, h);
    mergesort(arr, l, m, h);
  }
}
int main() {
  long long int ans = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    ans = ans + arr[i];
  }
  merge(arr, 0, n - 1);
  int m;
  cin >> m;
  int coup[m];
  for (int i = 0; i < m; i++) {
    cin >> coup[i];
    cout << ans - arr[n - coup[i]] << endl;
  }
}
