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