Prove that $\sum_{i=1}^{m}|A_i |\leq n+t{m\choose 2}$
Let $A_1 ,\ldots ,A_m$ be subsets of an $n$-element set such that $|A_i \cap A_j |\leq t$ for all $i\neq j$. Prove that $$\sum_{i=1}^{m}|A_i |\leq n+t{m \choose 2}$$
What I've tried:
I've tried to use the following lemma to prove the fact above:
Lemma: Let $X$ be a set of $n$ elements, and let $A_1 ,\ldots ,A_m$ be subsets of $X$ of average size at least $n/w$. If $N\geq 2w^2$, then there exist $i\neq j$ such that $|A_i \cap A_j |\geq \frac{n}{2w^2}$.
Now by contrary, let $\sum_{i=1}^{m}|A_i |\geq n+t{m \choose 2}+1$. Then $\frac{1}{m}\sum_{i=1}^{m}|A_i |\geq \frac{n+t{m \choose 2}+1}{m}$, where $\frac{1}{m}\sum_{i=1}^{m}|A_i |$ is the average size of $A_1 ,\ldots ,A_m$. But now I don't know what $w$ is here. I was wondering if someone could help me.
Use of Bonferroni inequalitie: $$n\geq \Big|\bigcup _{i=1}^n A_i\Big| \geq \sum _{i=1}^m|A_i|-\sum _{1\leq i<j\leq m} |A_i\cap A_j| \geq \sum _{i=1}^m|A_i| - t\cdot {m\choose 2}$$