#include <bits/stdc++.h>
int n, m;
std::vector<long long> prices;
std::vector<long long> discounts;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cin >> n;
  for (size_t i = 0; i < n; i++) {
    long long a;
    std::cin >> a;
    prices.push_back(a);
  }
  std::cin >> m;
  for (size_t i = 0; i < m; i++) {
    long long q;
    std::cin >> q;
    discounts.push_back(q);
  }
  std::sort(prices.begin(), prices.end(), std::greater<long long>());
  long long sum = std::accumulate(prices.begin(), prices.end(), 0LL);
  for (auto&& x : discounts) std::cout << sum - prices[x - 1] << '\n';
  return 0;
}
