#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<long long> prices;
  long long n, m, sum = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long price;
    cin >> price;
    sum = sum + price;
    prices.push_back(price);
  }
  sort(prices.rbegin(), prices.rend());
  cin >> m;
  for (long long i = 0; i < m; i++) {
    long long coupon;
    cin >> coupon;
    cout << sum - prices[coupon - 1] << "\n";
  }
}
