#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int maxn = 200005;
const int mod = 1000000007;
void task() {
  int n, a;
  cin >> n >> a;
  std::vector<int> t(n);
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  int ans = t[--a];
  for (int i = 1; a - i >= 0 or a + i <= n; i++) {
    int l = a - i < 0 or t[a - i] == 1;
    int r = a + i >= n or t[a + i] == 1;
    if (l and r) {
      if (a - i >= 0) ans++;
      if (a + i < n) ans++;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  for (int __ = 1; __ <= T; __++) {
    task();
  }
  return 0;
}
