program road_of_the_king
  implicit none
  integer(8), parameter :: md = 1000000007_8
  integer(8) :: dp(0:300,301,300) = 0_8
  integer :: n, m, i, j, k
  read(*,*) n, m
  dp(0,1,1) = 1_8
  do i = 0, m-1
    do j = 1, n
      do k = 1, n
        dp(i+1,j+1,k) = mod(dp(i+1,j+1,k)+dp(i,j,k)*int(n-j,8),md)
        dp(i+1,j,k) = mod(dp(i+1,j,k)+dp(i,j,k)*int(j-k,8),md)
        dp(i+1,j,j) = mod(dp(i+1,j,j)+dp(i,j,k)*int(k,8),md)
      end do
    end do
  end do
  write(*,'(i0)') dp(m,n,n)
end program road_of_the_king