#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, a;
  cin >> n >> a;
  int arr[n + 1];
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i <= n; i++) {
    if (arr[i]) {
      int temp = i - a;
      int d = a - temp;
      if (d > n || d < 1 || arr[d] == arr[i]) cnt++;
    }
  }
  cout << cnt;
  return 0;
}
