#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 123;
const int mod = 1e9 + 7;
const int INF = 1e9 + 1;
const long long INFL = 1e18 + 1;
const double eps = 1e-9;
const double pi = acos(-1.0);
int sum, n, a;
bool u[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a;
  for (int i = 1; i <= n; i++) {
    cin >> u[i];
    sum += u[i];
  }
  for (int i = 1; i <= min(a - 1, n - a); i++) {
    if (u[a - i] == 0 || u[a + i] == 0) {
      sum -= u[a - i] || u[a + i];
    }
  }
  cout << sum;
  return 0;
}
