#include <bits/stdc++.h>
using namespace std;
int numCriminal(int[], int, int);
int main(void) {
  int n, a;
  cin >> n >> a;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << numCriminal(arr, n, a - 1) << endl;
  return 0;
}
int numCriminal(int arr[], int n, int a) {
  int temp = 0;
  if (arr[a] == 1) temp++;
  for (int i = 1; i < n; i++) {
    if (a - i >= 0 && a + i < n) {
      if (arr[a - i] == 1 && arr[a + i] == 1) temp += 2;
    } else {
      if (a - i >= 0 && arr[a - i] == 1) temp++;
      if (a + i < n && arr[a + i] == 1) temp++;
    }
  }
  return temp;
}
