Exactly solvable nonlinear model for a Smith-Purcell free-electron laser