Latvia states of Northern and Eastern Europe were divided into German and Soviet "spheres of influence". In the north, Latvia, Finland and Estonia were assigned to the Soviet sphere. A week later, on 1 September 1939, Germany and on 17 September, the Soviet Union invaded Poland. After the conclusion of the Molotov-Ribbentrop Pact, most of the Baltic Germans left Latvia by agreement between Ulmanis' government and Nazi Germany under the Heim ins Reich programme. In total 50,000 Baltic Germans left by the deadline of December 1939, with 1,600 remaining to conclude business and 13,000 choosing to remain in Latvia. Most of
Poland–Russia border Soviet Union (USSR), shaped during the Polish-Soviet War, and confirmed at the Treaty of Riga at the line Dzisna-Dokshytsy-Słucz-Korets-Ostroh-Zbrucz. That border was long. Following World War II, the new border (see territorial changes of Poland immediately after World War II) was drawn between the People's Republic of Poland and the USSR. The new Polish-Soviet border was long at first, and subject to a minor modification in the 1951 Polish–Soviet territorial exchange, which reduced the border length to . The modern border between Poland and Russia is regulated by a number of legal documents, many of them dating to the times