let rec for_fold a b f v = if a >= b then v else for_fold (a+1) b f (f v a)
let _ = Scanf.scanf "%d %d" @@ fun n x ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  for_fold 0 (n+1) (fun s i ->
    let s' = Array.fold_left (+) 0 a in
    let a0 = min a.(0) a.(n-1) in
    for i = n-1 downto 1 do
      a.(i mod n) <- min a.(i mod n) a.((i-1) mod n)
    done; a.(0) <- a0;
    min s (s' + i*x)) 10101010101010
  |> Printf.printf "%d\n"