#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     long long n, m, i, ans = 0, z, j;     pair<long long, long long> a[105];     vector<pair<long long, long long> > q;     cin >> n >> m;     for (i = 1; i <= n; i++) a[i].second = 0;     for (i = 1; i <= n; i++) cin >> a[i].first;     for (j = 1; j <= m; j++) {       cin >> z;       a[z].second = 1;     }     for (i = 1; i <= n; i++) q.push_back(a[i]);     sort(q.begin(), q.end());     for (i = 0; i < n; i++)       if (q[i].second == 0) ans += q[i].first;     for (i = n - 1; i >= 0; i--)       if (q[i].second == 1) ans = ans + max(ans, q[i].first);     cout << ans << endl;     return 0;   }   