program garden
  implicit none
  integer :: n, i
  integer(8) :: k, l = 0_8, x = 3000000000000000000_8, m, s
  integer(8), dimension(100000) :: w = 0_8, d = 0_8
  read(*,*) n, k
  do i = 1, n
    read(*,*) w(i), d(i)
  end do
  do while (x-l > 1_8)
    m = (x+l)/2_8
    s = 0_8
    do i = 1, n
      if (m < w(i)) cycle
      s = s+(m-w(i))/d(i)+1_8
    end do
    if (s < k) then
      l = m
    else
      x = m
    end if
  end do
  write(*,'(i0)') x
end program garden