#include <bits/stdc++.h>
using namespace std;
int city[105];
int main() {
  int n, a;
  cin >> n >> a;
  for (int i = 1; i <= n; i++) cin >> city[i];
  int i, j, ans = 0;
  i = a - 1;
  j = a + 1;
  while (i > 0 || j <= n) {
    if (i < 1 && city[j])
      ans++;
    else if (j > n && city[i])
      ans++;
    else if (city[i] && city[j])
      ans += 2;
    i--;
    j++;
  }
  if (city[a]) ans++;
  cout << ans;
  return 0;
}
