#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n >> a;
  int c[n], count = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  if (c[a - 1] == 1) {
    count++;
  }
  int k = a - 1, r = n - a, p[a - 1], q[n - a], t = 0, l = 0;
  if (k < r) {
    for (int i = 0; i < k; i++) {
      p[i] = c[i];
    }
    for (int i = a + k - 1; i > a - 1; i--) {
      q[t] = c[i];
      t++;
    }
    for (int i = 0; i < k; i++) {
      if (p[i] == 1 && q[i] == 1) {
        count += 2;
      }
    }
    for (int i = a + k; i < n; i++) {
      if (c[i] == 1) {
        count++;
      }
    }
  } else {
    for (int i = a - r - 1; i < a - 1; i++) {
      p[t] = c[i];
      t++;
    }
    for (int i = a + r - 1; i > a - 1; i--) {
      q[l] = c[i];
      l++;
    }
    for (int i = 0; i < r; i++) {
      if (p[i] == 1 && q[i] == 1) {
        count += 2;
      }
    }
    for (int i = 0; i < a - r - 1; i++) {
      if (c[i] == 1) {
        count++;
      }
    }
  }
  cout << count;
  return 0;
}
