#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];
  }
  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;
  }
  cout << tecpoint << " ";
  return 0;
}
