#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1.0);
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 4;
int n;
vector<int> v;
map<int, int> mp;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int ar[500];
int main() {
  int a;
  int sum = 0;
  int i, n;
  scanf("%d%d", &n, &a);
  for (i = 1; i <= n; i++) {
    scanf("%d", &ar[i]);
  }
  int cont = 0;
  for (i = 1; i <= a; i++) {
    if (i == a && ar[a] == 1)
      cont++;
    else if (ar[i] == 1 && a + a - i > n) {
      cont += 1;
    } else if (ar[i] == 1 && ar[a + a - i] == 1)
      cont += 2;
  }
  for (i = a + a; i <= n; i++) {
    cont += ar[i];
  }
  printf("%d\n", cont);
  fflush(stdout);
  return 0;
}
