How T-cells use large deviations to recognize foreign antigens