Clear if $\rm\,a=0\,$ or $\rm\,b=0.\,$ Else the set $\rm\,S\,$ of $\rm\,k \in \mathbb Z\,$ with $\rm a^k = b^k\,$ is closed under subtraction $>0,\,$ i.e. $ $ if $\rm\,j > k\in S\,$ then cancelling $\rm \,0\ne a^k = b^k\,$ from $\rm\,a^j = b^j$ yields $\rm\,a^{j-k} = b^{j-k},\,$ so $\rm\,j\!-\!k\in S.$
Thus by this basic theorem every positive element of $\rm\,S\,$ is a multiple of the least positive $\rm\:d\in S$.
Thus $\rm\:n,m\in S\ \Rightarrow\ d\ |\ n,m\ \Rightarrow\ d\ |\ (n,m) = 1.\:$ Therefore $\rm\: d = 1\in S,\:$ i.e. $\rm\:a^1 = b^1.\ \ $ QED
Note $\ $ The key idea exploited above is that a set $\rm\,S\,$ of integers closed under $\rm\,subtraction\,$ is also closed under $\rm\,gcd\,$ (hence $\rm\,S\,$ contains $1$ if it contains coprime elements). This is the key idea behind the ancient $\rm\,subtractive\,$ form of the Euclidean algorithm for the $\rm\,GCD.$