#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<int> b(m);
  vector<bool> auction(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    b[i]--;
    auction[b[i]] = true;
  }
  sort(b.begin(), b.end(),
       [&](const int& i, const int& j) { return a[i] > a[j]; });
  long long score = 0;
  for (int i = 0; i < n; i++) {
    if (!auction[i]) {
      score += a[i];
    }
  }
  for (int i = 0; i < m; i++) {
    long long nextScore = max(score, 1LL * a[b[i]]);
    score += nextScore;
  }
  cout << score;
  return 0;
}
