Telefonica agreed to sell its business in Colombia to Millicom Spain for $400 million as the telecommunications company seeks to gradually reduce its exposure to Latin America.