#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-9);
const int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main(int argc, char const *argv[]) {
  file();
  int n, m;
  cin >> n >> m;
  vector<long long> q1(n), q2(m);
  for (int i = 0; i < n; ++i) {
    cin >> q1[i];
  }
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    q2[i] = q1[x - 1];
    q1[x - 1] = 0;
  }
  sort(((q1).rbegin()), ((q1).rend()));
  sort(((q2).rbegin()), ((q2).rend()));
  long long ans = accumulate(((q1).begin()), ((q1).end()), 0LL);
  for (auto i : q2) ans += max(i, ans);
  cout << ans;
}
