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