#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  int arr[n + 1];
  for (int i = 1; i < n + 1; i++) {
    cin >> arr[i];
  }
  int cnt = 0;
  for (int i = 0; i < n + 1; i++) {
    if (i == 0 && arr[x] == 1)
      cnt++;
    else {
      int pos = x + i < n + 1 ? arr[x + i] : -1;
      int neg = x - i > 0 ? arr[x - i] : -1;
      if (pos == 1 && neg == 1) cnt += 2;
      if ((pos == -1 || neg == -1) && (pos == 1 || neg == 1)) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
