#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
int main() {
  int n, a, arr[N], cnt = 0;
  scanf("%d %d", &n, &a);
  for (int i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  arr[0] = -1;
  if (arr[a] == 1) cnt++;
  int j = 1, posI = 0, posD = 0;
  while (1) {
    if (a + j > n) {
      posD = n + 1 - (j * 2);
      break;
    } else if (arr[a - j] == -1) {
      posI = a + j;
      break;
    }
    if (arr[a + j] == arr[a - j] && arr[a + j] == 1) {
      cnt += 2;
    }
    j++;
  }
  if (posI != 0) {
    for (int i = posI; i <= n; ++i) {
      if (arr[i] == 1) cnt++;
    }
  } else if (posD != 0) {
    for (int i = 1; i <= posD; ++i)
      if (arr[i] == 1) cnt++;
  }
  printf("%d", cnt);
  return 0;
}
