Denote $b/n=s$. We want a pointwise bound $$f(x)\leqslant f(s)+(x-s)f'(s),\quad\quad(\heartsuit)$$ then summing $(\heartsuit)$ up for $x=a_1,\ldots,a_n$ we get the desired inequality. Note that if $s<a$ (that holds for $n>b/a$) we get $(\heartsuit)$ on $[0,a]$ by concavity. For proving $(\heartsuit)$ on $[a,b]$, by convexity it suffices to verify $(\heartsuit)$ for $x=a$ and $x=b$. For $x=a$ this is already done, for $x=b$ it reads as $f(b)\leqslant f(s)+(b-s)f'(s)$. When $n$ is large, RHS converges to $f(0)+bf'(0)$. Thus it suffices to check that $f(b)<f(0)+bf'(0)$. Assume the contrary: $f(b)\geqslant f(0)+bf'(0)$. We have $f(x)\leqslant f(0)+f'(0)x$ for all $x\in [0,a]$ by concavity. Denote by $c$ the endpoint of the maximal segment $[0,c]$ on which we have $f(x)\leqslant f(0)+f'(0)x$. Then $c\in [a,b]$ and we have $f(c)=f(0)+f'(0)c$ (otherwise $c$ is not maximal). This yields $f'(c)=\lim_{x\to c-0}\frac{f(c)-f(x)}{c-x}\geqslant f'(0)$. Since $f'$ increases on $[a,b]$ by convexity we get $f'(b)\geqslant f'(c)\geqslant f'(0)$, a contradiction.