<s>[INST] Find integers $x,y$ such that $p=mx+ny$ Given a positive value $p$ and positive integers $m, n$ less than or equal to $p$, find integers (possibly negative) $x,y$ such that $p=mx+ny$.
What method can be used to find $x$ and $y$?
 [/INST] Are you familiar with the Euclidean algorithm? https://en.wikipedia.org/wiki/Euclidean_algorithm.
The Euclidean algorithm gives a way of finding $\gcd(m,n)$ and integers $x,y$ such that $mx + ny = \gcd(m,n)$. You can then scale to find a solution to $mx + ny = p$, assuming $\gcd(m,n) \mid p$. If not, then there is no solution.
Here is an example of how it works: Let $m = 6, n = 64$. We have
\begin{equation*}
\begin{aligned}
64 &= 6 \cdot 10 + 4 \\
6 &= 4 \cdot 1 + 2 \\
4 &= 2 \cdot 2 + 0.
\end{aligned}
\end{equation*}
Since $2$ is the last nonzero remainder, we have $2 = \gcd(6,64)$.
Now observe that
\begin{equation*}
\begin{aligned}
2 &= 6 - 4\cdot 1 \\
&= 6 - (64 - 6 \cdot 10) \cdot 1 \\
&= 6 - 1 \cdot 64 + 6 \cdot 10 \\
&= 11 \cdot 6 - 1 \cdot 64.
\end{aligned}
\end{equation*}
So $x = 11, y = -1$ is a solution to the equation $6m + 64y = \gcd(6,64)$.
</s>