let () = Scanf.scanf "%d %d\n" @@ fun n x ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  (* dp.(k).(i) = (i - k, i]の最小値 *)
  let dp = Array.make_matrix (n + 1) n max_int in
  for k = 0 to n - 1 do
    for i = 0 to n - 1 do
      dp.(k + 1).((i + k) mod n) <- min as_.(i) dp.(k).((i + k) mod n)
    done
  done;
  Printf.printf "%d\n" @@
  Array.fold_left min max_int @@
  Array.init n @@ fun k ->
    x * k + Array.fold_left ( + ) 0 dp.(k + 1)
