#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<pair<bool, int>> ab(n);
  vector<int> b(m);
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    cin >> ab[i].second;
  }
  for (int i = 0; i < m; ++i) {
    cin >> b[i];
    b[i]--;
  }
  for (int i = 0; i < m; ++i) {
    ab[b[i]].first = true;
  }
  sort(ab.begin(), ab.end());
  int cnt = 0;
  while (!ab[cnt].first) {
    res += ab[cnt].second;
    cnt++;
  }
  vector<int> auction(n - cnt);
  for (int i = 0; i < n - cnt; ++i) {
    auction[i] = ab[i + cnt].second;
  }
  sort(auction.begin(), auction.end());
  reverse(auction.begin(), auction.end());
  for (int i = 0; i < auction.size(); ++i) {
    res += max((long long)auction[i], res);
  }
  cout << res << "\n";
  return 0;
}
