From conservation of angular momentum, we have $m_v_pr_p=mv_ar_a$, where $v_p$ and $v_a$ are the speeds at the pericenter and the apocenter, respectively. Together with the conservation of energy
Therefore, the space probe requires a minimum energy of $GMm/(r_p+r_a)$ to escape from the planet (i.e. approaching infinity with very little kinetic energy left).