After the conclusion of the Molotov-Ribbentrop Pact, most of the Baltic Germans left Latvia by agreement between Ulmanis's 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 those who remained left for Germany in summer 1940, when a second resettlement scheme was agreed. The racially approved being resettled mainly in Poland, being given land and businesses in exchange for the money they had received from the sale of their previous assets.