Hungary elects Péter Magyar, vows to rejoin Europe and restore ties