#include <cassert>
#include <cstdio>
#include <algorithm>

int main()
{
  using namespace std;
  assert(freopen("invaders.in", "r", stdin) == stdin);
  assert(freopen("invaders.out", "w", stdout) == stdout);

  int n, p, ans = 0;
  assert(scanf("%d%d", &n, &p) == 2);
  int *a = new int[n];
  for (int i = 0; i < n; i++)
    assert(scanf("%d", &a[i]) == 1), ans += a[i];
  ans += n - 1 + min(p - 1, n - p);
  printf("%d\n", ans);

  delete[] a;
  return 0;
}

