#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n >> a;
  vector<int> arr(n + 1);
  for (int i = 1; i <= n; i++) cin >> arr[i];
  int ans = 0;
  for (int dist = 0; dist < n; dist++) {
    if (dist == 0) {
      if (arr[a]) ans++;
      continue;
    }
    if ((a - dist < 1 && (a + dist <= n && arr[a + dist])) ||
        (a + dist > n && (a - dist >= 1 && arr[a - dist]))) {
      ans++;
      continue;
    }
    int c1 = arr[a - dist], c2 = arr[a + dist];
    if ((c1 || c2) && c1 == c2) {
      ans += 2;
    }
  }
  cout << ans << '\n';
  return 0;
}
