#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, a;
  cin >> n >> a;
  int arr[1005];
  for (int i = 1; i < n + 1; ++i) {
    cin >> arr[i];
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (arr[i]) {
      int x = i - a;
      int j = a - x;
      if (j < 1 || j > n || arr[i] == arr[j]) {
        ans++;
      }
    }
  }
  cout << ans;
  return 0;
}
