A British teenager who was arrested in Georgia on drug smuggling charges has been freed from prison after agreeing a plea deal.