Large portfolio losses: A dynamic contagion model