program main
  implicit none
  integer :: N, x
  integer,allocatable :: A(:), B(:,:)
  integer :: i, j, idx
  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
      idx = j-i+1
      if (idx .le. 0) then
        idx = idx + N
      endif
      B(j,i) = min(B(j,i-1),A(idx))
    end do
    minc = min(sum(B(:,i)) + (i-1)*x, minc)
  end do
  write(*,'(i0)') minc
end program main