import scala.math.ceil

object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val n, k = sc.nextInt
    val as = List.fill(n)(sc.nextLong)

    val i = as.indexOf(1)
    println(
      ceil(i / 2).toInt + ceil((n - i) / 2).toInt
    )
  }
}
