Consider $ax+ay-a-2bx-2by+2b$. Do the grouping $ax+ay-a-2bx-2by+2b=\left(ax+ay-a\right)+\left(-2bx-2by+2b\right)$, and factor out $a$ in the first and $-2b$ in the second group.
$$a\left(x+y-1\right)-2b\left(x+y-1\right)$$
Factor out common term $x+y-1$ by using distributive property.