open Printf
let input_int_array n =
	Array.init n (fun _ -> Scanf.scanf " %d" (fun v -> v))

let get_int () = Scanf.scanf " %d" (fun v -> v)
let get_2_ints () = Scanf.scanf " %d %d" (fun u v -> u,v)
let get_3_ints () = Scanf.scanf " %d %d %d" (fun u v w -> u,v,w)
let get_4_ints () = Scanf.scanf " %d %d %d %d" (fun u v w x -> u,v,w,x)
let get_5_ints () = Scanf.scanf " %d %d %d %d %d" (fun u v w x y -> u,v,w,x,y)

let print_int_endline n = n |> string_of_int |> print_endline
let char_list_of_string str = 
  let rec f0 i a =
    if i<0 then a else f0 (i-1) (str.[i]::a)
  in f0 (String.length str - 1) []
let string_of_char_list ls = 
  List.fold_left (fun u v -> u ^ (String.make 1 v)) "" ls

let () =
  let s = Scanf.scanf " %s" (fun v -> v)
  in let w = get_int ()
  in let l = s |> char_list_of_string
  in
  let rec f0 l a k = match l with
  | h::t -> if k mod w <> 0 then f0 t a (k+1) else f0 t (h::a) (k+1)
  | [] -> a
  in
  f0 l [] 0 |> List.rev |> string_of_char_list |> print_endline




