program colorful_slimes
  implicit none
  integer :: n, i, j, k
  integer(8) :: x, a(4000), b(4000,0:2000), m, t
  a = 0_8
  b = 0_8
  read(*,*) n, x
  read(*,*) a(1:n)
  a(n+1:2*n) = a(1:n)
  b(1:2*n,0) = a(1:2*n)
  m = sum(a(1:n))
  do k = 1, n-1
    do i = n+1, 2*n
      b(i,k) = min(b(i,k-1),a(i-k))
    end do
    t = k*x+sum(b(n+1:2*n,k))
    m = min(m,t)
  end do
  write(*,'(i0)') m
  stop
end program colorful_slimes