Answer by taking a quote from the following article:

Mohammed Hussein redirects here; for the Muslim cleric, see Muhammad Ahmad Hussein. Babrak Karmal (Dari/Pashto: bbrkh khrml, born Sultan Hussein; 6 January 1929 - 1 or 3 December 1996) was an Afghan politician who was installed as president of Afghanistan by the Soviet Union when they invaded in 1979. Karmal was born in Kamari and educated at Kabul University.

Imprisoned from 1953 to 1956, Karmal befriended fellow inmate Mir Akbar Khyber, who introduced Karmal to Marxism. Karmal changed his name from Sultan Hussein to Babrak Karmal, which means "Comrade of the Workers'" in Pashtun, to disassociate himself from his bourgeois background. When he was released from prison, he continued his activities in the student union, and began to promote Marxism. Karmal spent the rest of the 1950s and the early 1960s becoming involved with Marxist organizations, of which there were at least four in Afghanistan at the time; two of the four were established by Karmal. When the 1964 Afghan Provisional Constitution, which legalised the establishment of new political entities, was introduced several prominent Marxists agreed to establish a communist political party. The People's Democratic Party of Afghanistan (PDPA, the Communist Party) was established in January 1965 in Nur Muhammad Taraki's home. Factionalism within the PDPA quickly became a problem; the party split into the Khalq led by Taraki alongside Hafizullah Amin, and the Parcham led by Karmal.  During the 1965 parliamentary election Karmal was one of four PDPA members elected to the lower house of parliament; the three others were Anahita Ratebzad, Nur Ahmed Nur and Fezanul Haq Fezan. No Khalqists were elected; however, Amin was 50 votes short of being elected. The Parchamite victory may be explained by the simple fact that Karmal could contribute financially to the PDPA electoral campaign. Karmal became a leading figure within the student movement in the 1960s, electing Mohammad Hashim Maiwandwal as Prime Minister after a student demonstration (called for by Karmal) concluded with three deaths under the former leadership.  In 1967, the PDPA unofficially split into two formal parties, one Khalqist and one Parchamist. The dissolution of the PDPA was initiated by the closing down of the Khalqist newspaper, Khalq. Karmal criticised the Khalq for being too communist, and believed that its leadership should have hidden its Marxist orientation instead of promoting it. According to the official version of events, the majority of the PDPA Central Committee rejected Karmal's criticism. The vote was a close one, and it is reported that Taraki expanded the Central Committee to win the vote; this plan resulted in eight of the new members becoming politically unaligned with and one switching to the Parchamite side. Karmal and half the PDPA Central Committee left the PDPA to establish a Parchamite-led PDPA. Officially the split was caused by ideological differences, but the party may have divided between the different leadership styles and plans of Taraki versus Karmal. Taraki wanted to model the party after Leninist norms while Karmal wanted to establish a democratic front. Other differences were socioeconomic. The majority of Khalqists came from rural areas; hence they were poorer, and were of Pashtun origin. The Parchamites were urban, richer, and spoke Dari more often than not. The Khalqists accused the Parchamites of having a connection with the monarchy, and because of it, referred to the Parchamite PDPA as the "Royal Communist Party". Both Karmal and Amin retained their seats in the lower house of parliament in the 1969 parliamentary election.

What were the Marxist organizations in Afghanistan at that time?
the 1964 Afghan Provisional Constitution, which legalised the establishment of new political entities,