#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return (b == 0) ? a : GCD(b, a % b); }
bool isPrime(int x) {
  for (int i = 2; i <= sqrt(x); i++)
    if (x % i == 0) return 0;
  return 1;
}
bool C[26];
int main() {
  int n, a;
  cin >> n >> a;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  int ans = 0;
  if (a - 1 < n - a) {
    reverse(v.begin(), v.end());
    a = n - a + 1;
  }
  a--;
  for (int i = 0; i < a + 1; i++) {
    if (v[i] == 1 && ((2 * a - i) >= n || i == a))
      ans++;
    else if (v[i] == 1 && v[2 * a - i] == 1)
      ans += 2;
  }
  cout << ans;
  return 0;
}
