The United States supported rebels in both countries.
My assumption is that you're referring to the Soviet war in Afghanistan (1979-1989) and the rise of the Solidarity movement in Poland in the 1980s.
In Afghanistan, the Soviets intervened in an effort to support a communist government there, and the United States provided support to the mujahideen (Islamic guerilla fighters battling against the Soviet army).
In Poland, the Soviet Union did not intervene directly but supported the imposition of marital law by the communist government of Poland. President Ronald Reagan of the US imposed economic sanctions on the Polish government and continued to apply moral pressure for the rights of the Polish people. The CIA also provided assistance to the underground Solidarity movement.