Buffalo have ended Kansas City's perfect start to the NFL season, beating the two-time defending Super Bowl champions 30-21 in New York.