The pupils were told they weren't allowed to leave the school until Derbyshire police had dealt with the issue