#include <bits/stdc++.h>
using namespace std;
void swap(long long *a, long long *b) {
  long long temp;
  temp = *a;
  *a = *b;
  *b = temp;
}
bool isPrime(long long n) {
  long long temp = sqrt(n) + 1;
  for (long long i = 2; i < temp; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int k[1111];
void solve() {
  long long n, a;
  cin >> n >> a;
  for (long long i = 0; i < n; i++) {
    cin >> k[i];
  }
  if (n == 2) {
    cout << k[0] + k[1] << "\n";
    return;
  }
  long long ans = 0;
  long long left = a - 2;
  long long right = a;
  while (left >= 0 && right <= n - 1) {
    if (k[left] * k[right] == 1) {
      ans += 2;
    }
    left--;
    right++;
  }
  while (left >= 0) {
    if (k[left] == 1) {
      ans++;
    }
    left--;
  }
  while (right <= n - 1) {
    if (k[right] == 1) {
      ans++;
    }
    right++;
  }
  if (a[k - 1] == 1) {
    ans++;
  }
  cout << ans << "\n";
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
