open Printf
open Scanf

let id x = x

let n, k = scanf "%d %d\n" (fun n k -> n, k)
let ary = Array.init n (fun _ -> scanf " %d" (fun v -> (float v, 1)))

let () = Array.sort (fun (a, _) (b, _) -> compare a b * ~-1) ary

let debug list =
    let list = List.map (fun (f, n) -> sprintf "(%f, %d)" f n) list in
    print_endline (String.concat "," list)

let rec insert x n = function
    | [] -> [(x, n)]
    | (y, m) :: rest when x < y -> (y, m) :: insert x n rest
    | (y, m) :: rest when x = y && n < m -> (y, m) :: insert x n rest
    | list -> (x, n) :: list

let rec run list k =
    (*
    printf "DEBUG: (%f, %d) %d\n" (fst (List.hd list)) (snd (List.hd list)) k;
    debug list;
    *)
    if k <= 0 then fst (List.hd list)
    else begin
        match list with
        | [] -> failwith "never happen"
        | (x, n) :: rest -> run (insert (x /. 2.) (n * 2) rest) (k - n)
    end

let () =
    let f = run (Array.to_list ary) k in
    printf "%d\n" @@ int_of_float (ceil f)
