#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  int n, a;
  cin >> n >> a;
  int t[n];
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  int i = 1, count = 0;
  if (t[a] == 1) {
    count++;
  }
  while (true) {
    if (a + i > n && a - i < 1) break;
    if (a - i > 0 && a + i <= n) {
      if (t[a - i] != 0 && t[a + i] != 0) {
        count += 2;
      }
    } else if (a + i > n) {
      if (a - i > 0) {
        count += t[a - i];
      }
    } else if (a - i < 1) {
      if (a + i <= n) {
        count += t[a + i];
      }
    }
    i++;
  }
  cout << count << endl;
  return 0;
}
