Optimal Detection of a Change in Distribution