#include <bits/stdc++.h>
using namespace std;
int val[101];
int main() {
  int n, a;
  cin >> n >> a;
  for (int i = 1; i <= n; i++) cin >> val[i];
  int flag = 1, step = 0, sum = 0;
  while (flag) {
    int start = a - step;
    int end = a + step;
    if (start < 1 && end > n)
      flag = 0;
    else {
      if (start > 0 && end <= n) {
        if (val[start] == 1 && val[end] == 1) {
          if (start == end)
            sum += 1;
          else
            sum += 2;
        }
      } else {
        if (start > 0)
          if (val[start] == 1) sum += 1;
        if (end <= n)
          if (val[end] == 1) sum += 1;
      }
      step += 1;
    }
  }
  cout << sum << endl;
  return 0;
}
