Equation : G-T = (S-I) - (X-M)
If government budget is deficit or G- T > 0, that deficit can be financed by S (Domestic savings) or borrowing foreign captal (X-M) (X-M <0)
However, i have a question: capital borrowed from foreigners must be used to finance the deficit in trade balance, how can capital borrowed be used to finance deficit government budget?