#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, l, r, c = 0;
  cin >> n >> a;
  int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  if (ar[a - 1] == 1) c++;
  l = a - 2;
  r = a;
  while (1) {
    int t;
    if (l == -1 && r == n) break;
    if (l == -1) {
      for (int i = r; i < n; i++) c = c + ar[i];
      break;
    }
    if (r == n) {
      for (int i = l; i >= 0; i--) c = c + ar[i];
      break;
    }
    if ((ar[l] + ar[r]) == 2) c = c + 2;
    l--;
    r++;
  }
  cout << c;
  return 0;
}
