#include <bits/stdc++.h>
using namespace std;
const int mxxx = 100005;
bool np[mxxx];
int si, primes[mxxx];
void sieve() {
  si = 0;
  np[0] = np[1] = 1;
  for (long long i = 3; i * i <= mxxx; i += 2) {
    if (np[i] == 0) {
      for (long long j = i * i; j < mxxx; j += (i * 2)) np[j] = 1;
    }
  }
  primes[si++] = 2;
  for (int i = 0; i < mxxx; i++) {
    if (np[i] == 0 && i % 2) primes[si++] = i;
  }
}
void primeFactors(int n) {
  while (n % 2 == 0) {
    cout << 2;
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      cout << i;
      n = n / i;
    }
  }
  if (n > 2) {
    cout << n;
  }
}
long long power(long long x, long long y) {
  long long temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else {
    if (y > 0)
      return x * temp * temp;
    else
      return (temp * temp) / x;
  }
}
long long fast_power(long long x, long long n, long long mood) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return fast_power(x * x, n / 2, mood);
  else
    return (x * fast_power((x * x) % mood, (n - 1) / 2, mood));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int index, r, l, n, cnt = 0;
  cin >> n >> index;
  index--;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 1; i < n; i++) {
    r = l = 0;
    if (index + i < n) {
      if (arr[i + index])
        r = 1;
      else
        r = 0;
    } else
      r = -1;
    if (index - i >= 0) {
      if (arr[index - i])
        l = 1;
      else
        l = 0;
    } else
      l = -1;
    if (l == 1 && r == 1)
      cnt += 2;
    else if (l == 1 && r == -1)
      cnt++;
    else if (r == 1 && l == -1)
      cnt++;
    else if (r == -1 && l == -1)
      break;
  }
  if (arr[index] == 1) cnt++;
  cout << cnt;
  return 0;
}
