#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, a;
  cin >> n >> a;
  a--;
  long long arr[n];
  for (long long i = 0; i < (long long)n; ++i) cin >> arr[i];
  long long i, j;
  i = j = a;
  long long cnt = 0;
  if (arr[a] == 1) cnt++;
  i--;
  j++;
  while (i >= 0 && j < n) {
    if (arr[i] == 1 && arr[j] == 1) cnt += 2;
    i--;
    j++;
  }
  while (i >= 0) {
    if (arr[i] == 1) cnt += 1;
    i--;
  }
  while (j < n) {
    if (arr[j] == 1) cnt += 1;
    j++;
  }
  cout << cnt << endl;
  return 0;
}
