1) The militia and 2) the people.
As you can read for yourself and it seems plain enough to me that the only entity that is to be regulated is the militia (i.e. National Guard and various reserve elements of the United States military) because it is necessary to ensure the security of a free state. It is also quite clear to me that the second part of the sentence deals solely with the, "people" and what is said in regards to the people? Their right to keep and bear arms shall not be infringed.
How anyone can say the guidance for the militia applies to the people is...well...reread paragraph one.
One sentence dealing with two entities and each is given it's own relatively clear guidance, both of which intended to guide future governments of their inherent responsibilities. The first; To ACT as the administrator. It is the U.S. governments (& states) responsibility to regulate (organize, equip, and maintain) said militia. The later to remind them that they shall not ACT to infringe the right of the people to keep and bear arms. It is blatantly ignorant to cross contaminate the two. One sentence, two entities, two sets of guidance.