EU agrees to move Brexit talks to second phase