5 . There are two piles of stones. If 100 stones are taken from the first pile and placed in the second pile, then the number of stones in the second pile will be twice that in the first pile. Conversely, if some stones are taken from the second pile and placed in the first pile, then the number of stones in the first pile will be six times that in the second pile. How many stones are there in the first pile at a minimum? And determine the number of stones in the second pile in this case.
Let the number of stones in the first and second piles be denoted as $x, y$. Let $z$ be the number of stones taken from the second pile and placed into the first pile. Thus, we obtain the equations
$$
\begin{array}{l}
2(x-100)=y+100, \\
x+z=6(y-z) .
\end{array}
$$

From (1), we get $y=2 x-300$, substituting this into (2) yields:
$$
4 x+7(x-z)=1800 \text{. }
$$

Therefore, $x-z$ must be divisible by 4. Let $x-z=4 t, t \in \mathbb{Z}$. From equation (3), we get $x=-7t+450$; hence $y=-14t+600, z=x-4t=-11t+450$. Since $x, y, z$ are natural numbers, they must satisfy the inequalities:
$$
\left\{\begin{array}{l}
-7 t+450>0, \\
-14 t+600>0, \\
-11 t+450>0 .
\end{array}\right.
$$

Solving this system of inequalities, we get $t \leqslant 40$. Since the value of $x$ decreases as $t$ increases, the minimum possible value of $x$ is achieved when $t$ is at its maximum, i.e., $t=40$. In this case, $x=170, y=40, z=10$. Upon verification, the values of $x, y, z$ satisfy the conditions of the problem.