Gov. Andrew M. Cuomo and legislative leaders said the agreement would lift the hourly pay in New York City to $15 by the end of 2018, with slower increases elsewhere.