Suppose that $A$ is finite and that $f:A\to B$ is surjective. Then $B$ is finite and $|B|\le|A|$, the equality holds $\iff$ $f$ is bijective.
I found that my previous proof is ambiguous at important arguments. So I decided to rewrite it here.
Let $I_n=\{i\in\Bbb N\mid i\le n\}$. Since $A$ is finite, there is a bijection $g:I_n\to A$. Thus $f\circ g: I_n\to B$ is surjective. We define a mapping $h:B\to I_n$ by $h(b)=\min\{i\in\Bbb N\mid f\circ g(i)=b\}$.
For $b_1,b_2\in B$, $h(b_1)=h(b_2) \implies \min\{i\in\Bbb N\mid f\circ g(i)=b_1\}=\min\{i\in\Bbb N\mid f\circ g(i)=b_2\}=\bar i$ $\implies f\circ g(\bar i)=b_1$ and $f\circ g(\bar i)=b_2 \implies b_1=b_2$. Thus $h$ is injective and consequently $h:B\to h[B]$ is bijective. Moreover, $h[B] \subseteq I_n$ and $I_n$ is finite. Hence $B$ is finite. We have $|B|=|h[B]|\le |I_n|=|A|$, then $|B|\le |A|$.
The equality holds $\iff |B| = |A| \iff h[B]=I_n \iff h:B \to I_n$ is bijective. So our task is to prove $h$ is bijective $\iff f$ is bijective. As $h$ is already injective and $f$ is already surjective, our task is to prove $h$ is surjective $\iff f$ is injective.
a. $h$ is surjective $\implies f$ is injective
For $a_1,a_2\in A$ and $f(a_1)=f(a_2)=b$. Since $a_1,a_2\in A$, there exist $i_1,i_2\in I_n$ such that $g(i_1)=a_1$ and $g(i_2)=a_2$. Then $f\circ g(i_1)=f\circ g(i_2)=b$. Then $i_1,i_2\in \{i\in\Bbb N\mid f\circ g(i)=b\}$. Assume $i_2>i_1$, then $i_2>i_1\ge \min\{i\in\Bbb N\mid f\circ g(i)=b\} =h(b)$ and consequently $i_2 \neq h(b)$. $f\circ g(i_2)=b\neq b'$ for all $b'\in B$ and $b'\neq b$. Then $i_2 \notin \{i\in\Bbb N\mid f\circ g(i)=b'\}$ for all $b'\in B$ and $b'\neq b$. Then $i_2 \neq \min\{i\in\Bbb N\mid f\circ g(i)=b'\}$ for all $b'\in B$ and $b'\neq b$. Then $i_2 \neq h(b')$ for all $b'\in B$ and $b'\neq b$. To sum up, $i_2 \neq h(b')$ for all $b'\in B$. Thus $i_2 \notin \operatorname{ran}h$. This contradicts the surjectivity of $h$. It follows that $i_1=i_2$, then $g(i_1)=g(i_2)$, then $a_1=a_2$. Hence $f$ is injective.
b. $f$ is injective $\implies h$ is surjective
For $m\in I_n$, if $f\circ g(k)=f\circ g(m)$, then $g(k)=g(m)$ by the fact that $f$ is injective. Then $k=m$ by the fact that $g$ is bijective. Hence $m=\min\{i\in\Bbb N\mid f\circ g(i)=f\circ g(m)\}$. Thus $h(f\circ g(m))=m$ where $f\circ g(m)\in B$. It follows that $h$ is surjective.
Best Answer
Your proof is fine. I like the insight of choosing to use the contrapositive - that's a skill that will serve you well, because it makes the proof swifter and more elegant here, in my personal opinion.
It might be worth spelling out in your proof that this in the contrapositive, and thus implies the result you intended to prove, just for completeness' sake, though. A minor nitpick but nothing huge.