#include <bits/stdc++.h>
int main() {
  int n, a, count = 0, d;
  scanf("%d%d", &n, &a);
  int ar[n];
  for (int i = 0; i < n; i++) scanf("%d", &ar[i]);
  a -= 1;
  if (a > n - 1 - a)
    d = n - 1 - a;
  else
    d = a;
  for (int i = 0; i <= d; i++) {
    if (i == 0) {
      if (ar[a + i] == 1 && ar[a - i] == 1) count++;
    } else {
      if (ar[a + i] == 1 && ar[a - i] == 1) count += 2;
    }
  }
  if (a > n - 1 - a) {
    for (int i = 0; i < a - (n - 1 - a); i++) {
      if (ar[i] == 1) count++;
    }
  } else {
    for (int i = (2 * a) + 1; i < n; i++) {
      if (ar[i] == 1) count++;
    }
  }
  printf("%d", count);
  return 0;
}
