#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, flag = 0, ans = 0, sum = 0;
  int map[1005];
  memset(map, 0, sizeof(map));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (x) {
      if (abs(i - m) > (m - 1) || abs(i - m) > (n - m) || abs(i - m) == 0)
        ans++;
      else {
        if (map[abs(i - m)]) ans += 2;
        map[abs(i - m)]++;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
