At least 25 people killed in Pakistan and 20 in Afghanistan after heavy rains, flash floods and snowfall.