Adjoint analysis of Buckley-Leverett and two-phase flow equations