#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n >> a;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int L = a - 2, R = a, cnt = 0;
  if (v[a - 1]) cnt++;
  while (L > -1 && R < n) {
    if (v[L] && v[R]) cnt += 2;
    L--;
    R++;
  }
  while (R < n) {
    if (v[R]) cnt++;
    R++;
  }
  while (L > -1) {
    if (v[L]) cnt++;
    L--;
  }
  cout << cnt;
  return 0;
}
