#include <bits/stdc++.h>
using namespace std;
long long max(long long x, long long y) {
  if (x > y) return x;
  return y;
}
int main(int argc, char *argv[]) {
  int n, m, i;
  long long x;
  cin >> n >> m;
  vector<int> V(n), I(m), W(m);
  for (i = 0; i < n; i++) cin >> V[i];
  for (i = 0; i < m; i++) {
    cin >> x;
    W[i] = V[x - 1];
    I[i] = x - 1;
  }
  sort(I.begin(), I.end());
  for (i = m - 1; i >= 0; i--) V.erase(V.begin() + I[i]);
  sort(W.begin(), W.end());
  for (x = i = 0; i < V.size(); i++) x += V[i];
  for (i = W.size() - 1; i >= 0; i--) x += max(W[i], x);
  cout << x;
  return EXIT_SUCCESS;
}
