y=\frac{ka+b}{2} \iff b=2y-ka.