#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  for (auto vi : v) out << vi << ", ";
  out << "]\n";
  return out;
}
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  vector<int> a;
  cin >> n >> k;
  k--;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    a.push_back(temp);
  }
  int answer = 0;
  for (int i = 0; i <= n; i++) {
    vector<int> temp;
    if (0 <= k - i) temp.push_back(a[k - i]);
    if (i > 0 && k + i < n) temp.push_back(a[k + i]);
    bool allK = true;
    for (auto p : temp) {
      if (p == 0) allK = false;
    }
    if (allK) {
      answer += temp.size();
    }
  }
  cout << answer << "\n";
  return 0;
}
