Proving an inequality via the Cauchy-Schwarz Inequality

I apolgize for contributing yet another question asking about an application of CS. Here it is:

Suppose $p_1, \dots ,p_n$ and $a_1,...,a_n$ are real numbers such that $p_i \geq 0$, $a_i \geq 0$ for all $i$, and $p_1 + \dots + p_n = 1$. Then $$(p_1a_1+ \dots + p_na_n)\left(\frac{p_1}{a_1}+ \dots + \frac{p_n}{a_n}\right) \geq 1$$

The author of my textbook gives the following proof: Apply Cauchy's inequality to the sequences $\sqrt{p_1a_1} \dots \sqrt{p_n}{a_n}$ and $\sqrt{\frac{p_1}{a_1}} \dots \sqrt{\frac{p_n}{a_n}}$. (Thats it)

In trying to fill in the blanks I obtained the following $$\sqrt{p_1a_1} +\dots +\sqrt{p_na_n} \leq \sqrt{p_1+\dots+p_n}\sqrt{a_1+...+a_n} = \sqrt{a_1+...+a_n}$$ and $$\sqrt{\frac{p_1}{a_1}} +\dots +\sqrt{\frac{p_n}{a_n}} \leq \sqrt{p_1+\dots+p_n}\sqrt{\frac{1}{a_1}+...+\frac{1}{a_n}} = \sqrt{\frac{1}{a_1}+...+\frac{1}{a_n}}$$ I'm not entirely sure where to go from here. Perhaps I have misunderstood what he meant by "apply cauchy's inequality to the sequences...". Another idea I had was to note that $$(p_1a_1+ \dots + p_na_n) \leq M_a(p_1+ \dots + p_n)$$ where $M_a$ is the largest $a_i$. And, that $$\left(\frac{p_1}{a_1}+ \dots + \frac{p_n}{a_n}\right) \leq \frac{1}{m_a}(p_1+\dots+p_n)$$ where $m_a$ is the smallest $a_i$. Therefore, since $\frac{M_a}{m_a} \geq 1$ the inequality follows. I am not very confident in the correctness of this method though and would like to understand how to prove the inequality via CS as my book suggests.

C-S is the following. $$(a_1^2+a_2^2+...+a_n^2)(b_1^2+b_2^2+...+b_n^2)\geq(a_1b_1+a_2b_2+...+a_nb_n)^2.$$ Hence, for positives $a_i$ and your $p_i$ we obtain: $$(p_1a_1+ \dots + p_na_n)\left(\frac{p_1}{a_1}+ \dots + \frac{p_n}{a_n}\right)=\sum_{i=1}^n\left(\sqrt{p_ia_i}\right)^2\sum_{i=1}^n\left(\sqrt{\frac{p_i}{a_i}}\right)^2\geq$$ $$\geq\left(\sum_{i=1}^n(\sqrt{p_ia_i}\sqrt{\frac{p_i}{a_i}}\right)^2=\left(\sum_{i=1}^np_i\right)^2=1$$