In one key step of solving AtCoder Grand Contest 051, Problem E, one must solve the following subproblem (see the editorial for more information):
Given $$$n$$$ vectors $$$P_1, P_2, \cdots, P_n$$$, whose x- and y-components are integers, the set of vectors that can be expressed as $$$\Sigma w_iP_i$$$, where $$$w_i$$$ are arbitrary integers, can be expressed as {$$$mA + nB \mid m, n \in \mathbb{Z} $$$} (I understand why this is true), where $$$A$$$ and $$$B$$$ are some vectors. Find $$$A$$$ and $$$B$$$.
The editorial states that the problem can be solved using a "gcd-like algorithm", but I am struggling to figure out what the algorithm actually is. Can someone provide more details? This appears to be an interesting problem that can be useful for solving other problems as well.