program main
  implicit none
  integer :: N, x
  integer,allocatable :: A(:), B(:,:)
  integer :: i, j
  integer :: minc
  read(*,*) N, x
  allocate( A(N) )
  allocate( B(N,N) )
  read(*,*) A(:)
  B(1,:) = A(:)
  minc = sum(B(1,:))
  do i=2,N
    do j=1,N
      B(i,j) = min(B(i-1,j),A(mod(N+j-i,N)))
    end do
    minc = min(sum(B(i,:)) + i*x, minc)
  end do
  write(*,'(i0)') minc
end program main