$K$ consecutive heads with a biased coin?
Per Borel-Cantelli theorem you need to determine convergence of $\sum_{k \geqslant 1}\mathbb{P}\left(A_k\right)$. Per section 14.1 of the "Problems and snapshots from the world of probability" by Blom, Holst and Sandell the probability than amongst $2^k$ throws considered in $A_k$ a run of heads of length $\geqslant k$ will occur can be extracted from the probability generating function: $$ \mathbb{P}\left(A_k\right) = [s^{2^k}] \frac{p^k s^k (1-p s)}{\left(1-s + (1-p)p^k s^{k+1}\right)\left(1-s\right)} = [s^{2^k}] G_{k,p}(s) $$ Because $n=2^k$ grows much faster than $k$, we can use asymptotic techniques to find $c_n = [s^n]G_{k,p}(s)$. The large $n$ behavior of $c_n$ is determined by smallest positive roots of the denominator of $G_{k,p}(s)$. The smallest in absolute value root of equation $1-s + (1-p)p^k s^{k+1}$ is close to $s=1$, specifically: $$ s_\ast = 1 + \frac{(1-p) p^k}{ 1-(k+1) (1-p) p^k } + \mathcal{o}\left(p^k\right) > 1 $$ Thus in the vicinity of $s=1$ the $G_{k,p}(s)$ behaves as $$ G_{k,p}(s) \approx \frac{p^k s^k (1-ps)}{(s_\ast - s) (1-s)} = \sum_{m=k}^\infty s^m p^k \frac{1 - s_\ast^{m-k+1} - p (1- s_\ast^{k-m})}{s_\ast - 1} $$ and thus since for large $k$ the root $s_\ast$ is very close to $1$ giving $$ \left[s^{2^k}\right] G_{k,p}(s) \approx 1 - \left(1-\frac{p^k}{1-k (1-p) p^k }\right) s_\ast^{k - 2^k} \approx 1 - \exp\left(-\lambda_k \right) $$ where $$ \lambda_k = (2^k -k ) (s_\ast - 1) = (2^k -k )\frac{(1-p) p^k}{ 1-(k+1) (1-p) p^k } $$ Clearly $\lim_{k \to \infty} \lambda_k = 0$ and thus $\lim_{k \to \infty} \mathbb{P}(A_k) = 0$ exponentially for $2p < 1$, and thus $\sum_{k \geqslant 1} \mathbb{P}(A_k)$ convergence, hence $\mathbb{P}\left(A_k \text{ i.o}\right) = 0$ by Borel-Cantelli theorem.
Furthermore $\lim_{k \to \infty} \lambda_k = \infty$ for $2p>1$ implying $\mathbb{P}\left(A_k \text{ i.o}\right) = 1$.
When $p=\frac{1}{2}$ we have $$\lambda_k = \left(2^k -k \right) \frac{2^{-k-1}}{1-(k+1) 2^{-k-1}} \rightarrow_{k \to \infty} \frac{1}{2} $$ therefore $\mathbb{P}(A_k) \to 1-\exp(-1/2)$ and the sum $\sum_{k \geqslant 1} \mathbb{P}(A_k)$ diverges, implying $\mathbb{P}\left(A_k \text{ i.o}\right) = 1$.
Nice question! Being a homework, I am sure there must be a simpler solution, and I am very keen to see it now.