#include <bits/stdc++.h>
using namespace std;
double dis(int x1, int y1, int x2, int y2) {
  return sqrt(1.0 * (x1 - x2) * (x1 - x2) + 1.0 * (y1 - y2) * (y1 - y2));
}
int main() {
  int n, a;
  cin >> n >> a;
  a--;
  int D[n];
  for (int i = 0; i < n; i++) {
    cin >> D[i];
  }
  int i = 0;
  int ans = 0;
  while (a - i >= 0 || a + i < n) {
    if (a - i >= 0 && a + i < n) {
      if (D[a - i] == D[a + i] && D[a - i] == 1) {
        if (i == 0) {
          ans++;
        } else {
          ans = ans + 2;
        }
      }
    } else if (a - i >= 0) {
      if (D[a - i] == 1) {
        ans++;
      }
    } else {
      if (D[a + i] == 1) {
        ans++;
      }
    }
    i++;
  }
  cout << ans;
  return 0;
}
