Use the Euclidean algorithm to find integers $x$ and $y$ such that $164x + 39y = 1,$ with the smallest possible positive value of $x$.