#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, t, c = 0, x = 0;
  cin >> n >> m;
  vector<int> s;
  for (int j = 0; j < n; ++j) {
    cin >> x;
    s.push_back(x);
  }
  t = n - m;
  if (t > (m - 1)) {
    t = t - (m - 1);
    for (int r = 0; r < t; ++r) {
      if (s[(n - 1) - r] == 1) {
        c++;
      }
    }
  } else if (t < (m - 1)) {
    t = -t + (m - 1);
    while (t != 0) {
      if (s[(0 + x)] == 1) {
        c++;
      }
      t--;
      x++;
    }
  } else {
    t = 0;
  }
  if (s[m - 1] == 1) {
    c++;
  }
  x = n - (t + 1);
  x /= 2;
  for (int i = 1; i <= x; ++i) {
    if (s[(m - 1) + i] == s[(m - 1) - i] && s[(m - 1) - i] == 1) {
      c += 2;
    }
  }
  cout << c << endl;
  return 0;
}
