#include <bits/stdc++.h>
int main() {
  int n, k;
  int times = 0;
  std::cin >> n >> k;
  if (n == k) {
    std::cout << 1 << std::endl;
    return 0;
  }
  int arr;
  int index = -1;
  for (int i = 0; i < n; i++) {
    std::cin >> arr;
    if (arr == 1) {
      index = i + 1;
    }
  }
  arr = index;
  while (1) {
    times++;
    arr += 2;
    if (arr >= n) {
      break;
    }
  }
  arr = index;
  while (1) {
    times++;
    arr -= 2;
    if (arr <= 1) {
      break;
    }
  }
  std::cout << times << std::endl;
  return 0;
}
