As an alternative;
=MAX(INDEX(QUERY(A1:B, "Select Sum(A), B Group By B"),,1))
which calculates the Max of the first column of the query result.
Max