#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n;
  cin >> a;
  int ans = 0;
  int cnt = 0;
  vector<int> v(n);
  vector<int> b(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] == 1) cnt++;
  }
  if (cnt == 1) {
    ans = 1;
  } else {
    for (int j = 0; j < n; j++) {
      int l = a - j;
      int r = a + j;
      if ((l) > 0 && (r) <= n) {
        if (v[l - 1] != v[r - 1]) {
          b[l - 1] = 1;
          b[r - 1] = 1;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      if (!b[i] && v[i]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
