After signing KG, we have somewhere around $14 million left under the cap. If we sign Ray, that leaves us with $8 million.
We have two options: we can try to sign other teams' free agents with our cap space, or instead we can retain our own free agents (Bass, Green, Krstic, Ray), and use the MLE. The MLE is $5 million if we keep our total payroll (including the MLE) under $74 million, or $3 million if we exceed that amount.
There's no realistic way to sign Mayo, Ray, and Green, unless Mayo is taking the MLE.