This is a very complicated question, because the priorities are not linear. Every dollar of military spending is not the same as every dollar of helping the poor. It's helpful to think of a hierarchy of needs: A government must achieve the minimum at one stage to move forward, but additional effort beyond the minimum can actually detract from achieving the higher level needs.
A country's most important requirements are to keep the peace against potential threats domestic and internationally. That means some kind of military, some kind of police force or legal system, and almost always some kind of diplomacy and/or espionage and/or national security. Yet, when I was asked to rank the potential areas of government priority, I did not vote for strong defense in the list of priorities. Why?
The problem is the security dilemma. Every dollar put into defense spending is a dollar that other nations feel they must match. And when nations move from appropriate defense dealing with the actual likely threats they have to deal with to an offensive or power-projection military, the society inevitably suffers in terms of its freedom and prosperity in the long term. Historically, the big expansionist empires very rapidly began to deal with the strain of that expansion. And within today's technological, social and institutional equilibrium, there's just too much harm that can be done by even a few people who want to lash back against a group that has gone too far.
So once a government has insured the basic safety of its citizens from crime, disaster and natural happenstance, and foreign threats, what then?
Next it has to secure the civil liberties and basic survival of its citizens. If a society is under attack, shared sacrifice makes a lot of sense, though even then it should be as equitable and free as possible. But the moment there is not an apocalyptic threat to a society, the people in that society need reasonable access to the basics of survival and to liberties that government is not standing in the way of. A society where some have billions and some are starving is not just: The social contract demands too much and gives too little at that point. Nor is a society where people could be free but aren't just.
At this point, government has to make sure it is not only minimal and efficient but also non-corrupt. Corruption doesn't matter as much in the earlier stages because the efforts to combat it just can't be easily afforded. But at this stage of resources, corruption acts as a brake for almost everything else. It imperils public trust and guarantees the wasteful and unequal distribution of resources.
After that, government should move forward with non-coercive efforts to provide services, as long as doing so does not deplete a tax base or cause other harms. That includes providing utilities that it can provide more efficiently than other institutions (e.g. the market), providing public education, subsidizing art and science, etc.
Social security services for the elderly and disabled tend to apply here as well. This is for a variety of reasons. First: No one who is unable to contribute should be allowed to starve. Second: All too often, society contributes to the health issues of the disabled or elderly.
Various other governmental tasks are also relevant at this stage of resources. Public service announcements and proactive public health interventions are reasonable here too, again under the proviso that they are not implemented coercively.
Next, if it can do so efficiently and without harming important stakeholders or threatening civil liberties, government can get involved in the economy. This should generally be through appropriate regulation and enforcement, or through the backing of the society's currency through an appropriately regulated (and preferably as democratic as possible) central bank.
If, after all this, government can afford foreign aid, and the people through legitimate democratic means express an interest to provide that foreign aid, that is a reasonable agenda.
Throughout all of this, government should make sure it is procedurally lean and as local as possible.
Finally, I do not believe in combating illegal immigration as an objective because by and large no immigration should be illegal. Unless there is an absolute need to control immigration, like an immediate ecological catastrophe, an outbreak of plague, or suspicion beyond a reasonable doubt that the immigrant in question is an imminent threat, migration must be a human right. This is especially true under capitalism, where the system is only efficient when people can seek out the best labor for their skills and capabilities, but remains true even under other social configurations.