Inequality with edges and chromatic number.

I have proved the statement : Every graph $G$ with $\chi(g)=k$ has at least $\binom{k}{2}$ edges. I did this my saying for any 2 colours, there exists an edge connecting one vertex of one colour to the other, otherwise you could set all vertices of one colour to be the first and then you would have a graph with a $k-1$ colouring. I said that there are $\binom{k}{2}$ possible permutations of pairs of colours, and since any edge cannot connect more than 2 colours, that means that there must be $\binom{k}{2}$ edges of the graph.

What I am struggling with is the next part: Let $e(G) = m$ be the number of edges in $G$, using the result proved above, prove that $\chi(g)\leq \frac{1}{2} + \sqrt{2m+\frac{1}{4}}$

I'm not really sure where to even start with this, I have tried to find the inverse of the top result, if given the number of edges what can that say about the chromatic number but haven't had any success in doing so. Is there any hints you could give me or show me how to get started with this proof? Thanks.