Russia demanded half of Poland in exchange for allying with Britain and France against Hitler. When they refused, Stalin went with Hitler.
Pretty sure the Soviets knew Hitler was after them all along, as this map published in 1939 illustrates.