Suppose we have two different types of coin which are worth relatively prime positive integer amounts. In this case, it is possible to make change for all but finitely many quantities. Your job is to find the largest amount that cannot be made with these two types of coin.
Task
Input: A pair of relatively prime integers \$(a,b)\$ such that \$1<a<b\$.
Output: The largest integer that cannot be expressed as \$ax+by\$ where \$x\$ and \$y\$ are nonnegative integers.
Scoring:
This is code golf so shortest answer in bytes wins.
Example:
Input \$(3,11)\$
\$4\cdot 3- 1\cdot 11=1\$, so if \$n\geq 22\$ we can write \$n=q\cdot 3 + 2\cdot 11 +r\$ where \$q\$ is the quotient and \$r\in\{0,1,2\}\$ the remainder after dividing \$n-22\$ by \$3\$. The combination \$(q+4r)\cdot 3 + (2-r)\cdot 11 = n\$ is a nonnegative combination equal to \$n\$. Thus the answer is less than \$22\$. We can make \$21=7\cdot 3\$ and \$20=3\cdot 3 + 1\cdot 11\$ but it's impossible to make \$19\$ so the output should be \$19\$.
Test Cases:
[ 2, 3] => 1
[ 2, 7] => 5
[ 3, 7] => 11
[ 3, 11] => 19
[ 5, 8] => 27
[ 7, 12] => 65
[19, 23] => 395
[19, 27] => 467
[29, 39] => 1063
[ 1, 7] => error / undefined behavior (inputs not greater than one)
[ 6, 15] => error / undefined behavior (not relatively prime).
[ 3, 2] => error / undefined behavior (3 > 2)
[-3, 7] => error / undefined behavior (-3 < 0)