New York legalizes same-sex marriage