Joe Clarke scored a hundred, and Jack Haynes 77 on debut, as Nottinghamshire edged past Essex' first innings score in the Vitality County Championship before a flurry of wickets drew the visitors back into the contest on day two.