Prove that all subgroup of a cyclic group generated by $a$ is of the form $\langle a^k\rangle$ where $k|o(G)$
Attempt: Let $o(G)=n$. Let $K=\langle a^k\rangle$. Then $o(a^k)=\frac{n}{gcd(n,k)}$
In general, $k\mid n$ or $k\nmid n$. But how to conclude the remaining. Please help me with simple logic.
Expanding on the suggestion of Stahl in the comments here is an outline of how to solve the problem:
Let $S$ be a subgroup of a finite group $G=\langle a \rangle$. Then, for each element $s$ in $S$, there exists $n \in \mathbb{N}$ such that $s=a^n$ (why?). Now let $T = \{n \in \mathbb{N}\,|\,a^n \in S, n\geq 1\}$.
(a) Explain why $T$ has a least element $k$.
(b) Explain why $\langle a^k \rangle$ is a subgroup of $S$.
(c) Now suppose that $s \in S$. Then $s=a^n$ for some $n \in \mathbb{N}$.
(i)Use Bezout's identity to show that $a^{\gcd(k,n)}$ is in $S$.
(ii)Explain why this means that $s$ is in $\langle a^k\rangle$.
(d) Use a Corollary of Lagrange's theorem to show that $k$ divides $|G|$.