Answer based on context:

In April 1920 Poland launched the large-scale Kiev Offensive in hopes to capture Ukraine. Initially successful, the Polish Army started retreating after Russian counterattacks in early June 1920. Soon the Soviet forces began to threaten Poland's independence as they reached and crossed the Polish borders. On July 9, Polish Prime Minister Władysław Grabski asked the Allied Powers in the Spa Conference for military assistance in the war with the Soviets. The conference proposed that the Polish forces would withdraw behind the Curzon Line, the Soviet forces would stop 50 km  to the east of the line, the Lithuanian forces would take control of Vilnius, and all other disputes would be settled via negotiations in London. Grabski opposed the transfer of Vilnius, but under pressure of British Prime Minister Lloyd George, agreed to the resolution on July 10. At the same time Soviets and Lithuanians negotiated the Soviet-Lithuanian Peace Treaty, which was signed on July 12, 1920. Russia recognized Lithuanian independence and withdrew any territorial claims. The treaty drew the eastern border of Lithuania, which the Lithuanians continued to claim as their de jure state border until World War II. Vilnius Region, including Brasłaŭ, Hrodna, Lida, and Vilnius, was recognized to Lithuania. On August 6, after long and heated negotiations, Lithuania and Soviet Russia signed a convention regarding withdrawal of Russian troops from the recognized Lithuanian territory. However, the troops began to retreat only after the Red Army suffered a heavy defeat in Poland.

What event happened first, the Peace Treaty being signed, or the Polish Army retreating after the Russian counterattacks?
Polish Army retreating after the Russian counterattacks