#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, ind, sum = 0;     cin >> n;     long long mas[n];     for (long long i = 0; i < n; i++) {       cin >> mas[i];       sum += mas[i];     }     cin >> m;     long long arr[m];     sort(mas, mas + n);     for (long long i = 0; i < m; i++) {       cin >> arr[i];       cout << sum - mas[n - arr[i]] << endl;     }     return 0;   }   