#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
bool isPrime(int N) {
  for (int i = 2; i * i <= N; ++i) {
    if (N % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, a;
  cin >> n >> a;
  vector<int> arr(n);
  for (int &x : arr) cin >> x;
  int flag = 0;
  if (arr[a - 1] == 1) flag++;
  for (int i = 1; i <= n; ++i) {
    if ((a - 1 - i) >= 0 && (a - 1 + i) <= n - 1) {
      if (arr[a - 1 - i] == 1 && arr[a - 1 + i] == 1) flag += 2;
    } else if ((a - 1 - i) >= 0 && (a - 1 + i) > n - 1) {
      if (arr[a - 1 - i] == 1) flag++;
    } else if ((a - 1 - i) < 0 && (a - 1 + i) <= n - 1) {
      if (arr[a - 1 + i] == 1) flag++;
    }
  }
  cout << flag << "\n";
  return 0;
}
