#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long tecpoint = 0;
  vector<long long> mas(n);
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> mas[i];
  }
  vector<long long> questions(m);
  vector<bool> visited(n);
  for (int i = 0; i < m; i++) {
    int a;
    cin >> a;
    a--;
    questions[i] = mas[a];
    visited[a] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (!visited[i]) tecpoint += mas[i];
  }
  long long ma = -1;
  long long defpoint = tecpoint;
  {
    vector<bool> take(m);
    for (int i = 0; i < m; i++) {
      long long tecma = 0;
      long long tecmai = 0;
      for (int j = 0; j < m; j++) {
        if (take[j]) continue;
        if (max(questions[j], tecpoint) > tecma) {
          tecma = max(questions[j], tecpoint);
          tecmai = j;
        }
      }
      tecpoint += tecma;
      take[tecmai] = 1;
    }
  }
  ma = tecpoint;
  tecpoint = defpoint;
  {
    sort(questions.begin(), questions.end());
    for (int i = m - 1; i >= 0; i--) tecpoint += max(tecpoint, questions[i]);
  }
  ma = max(ma, tecpoint);
  tecpoint = defpoint;
  {
    sort(questions.begin(), questions.end());
    for (int i = 0; i < m; i++) tecpoint += max(tecpoint, questions[i]);
  }
  ma = max(ma, tecpoint);
  cout << ma << " ";
  return 0;
}
