#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 20;
const double pi = 3.141592653;
void fast() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fast();
  int n, a, s = 0;
  cin >> n >> a;
  int t[n];
  for (int i = 0; i < n; i++) cin >> t[i];
  if (a == 1) {
    for (int i = 0; i < n; i++)
      if (t[i] == 1) s++;
    cout << s;
    return 0;
  } else if (a == n) {
    for (int i = n - 1; i >= 0; i--)
      if (t[i] == 1) s++;
    cout << s;
    return 0;
  } else {
    if (t[a - 1] == 1) s++;
    int i = a;
    int j = a - 2;
    while (j >= 0 && i < n) {
      if (t[i] == 1 && t[j] == 1) s += 2;
      i++;
      j--;
    }
    if (j == -1 && i == n) {
      cout << s;
      return 0;
    } else if (j == -1) {
      for (int k = i; k < n; k++)
        if (t[k] == 1) s++;
      cout << s;
      return 0;
    } else {
      for (int k = j; k >= 0; k--)
        if (t[k] == 1) s++;
      cout << s;
    }
  }
}
