Prove that $p | a_i$ for some i
Your argument is incorrect. There is no way to prove that $p$ must be coprime with some of the factors: consider the case $p=2$, $a_1=a_2=\dots=2$.
It’s much simpler: if $p\mid a_1\dots a_ka_{k+1}$, consider $$ p\mid (a_1\dots a_k)a_{k+1} $$ and apply what you know about the case $n=2$.