#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 101;   int n, m;   struct price {     int p;     int au;     bool operator<(const price &rhs) const {       if (au == rhs.au) return p > rhs.p;       return au < rhs.au;     }   } price[MAX_N];   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) {       scanf( %d , &price[i].p);     }     for (int i = 0; i < m; ++i) {       int x;       scanf( %d , &x);       price[x].au = 1;     }     sort(price + 1, price + n + 1);     long long ans = 0;     for (int i = 1; i <= n; ++i) {       if (price[i].au == 0) {         ans += price[i].p;       } else {         if (ans > price[i].p)           ans *= 2;         else           ans += price[i].p;       }     }     printf( %I64d n , ans);     return 0;   }   