#include <bits/stdc++.h>
using namespace std;
int mod = 1000000000 + 7;
const int N = 3 * 100005;
const double PI = acos(-1);
int main() {
  int n;
  cin >> n;
  int a[n];
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  sort(a, a + n);
  reverse(a, a + n);
  int m;
  scanf("%d", &m);
  while (m--) {
    int c;
    scanf("%d", &c);
    long long tmp = sum;
    c--;
    if (c < n) tmp -= a[c];
    cout << tmp << endl;
  }
  return 0;
}
