If no candidate has been elected to a nonpartisan office pursuant to Section 8140 or if the number of candidates elected at the primary election is less than the total number to be elected to that office, then candidates for that office at the ensuing election shall be those candidates not elected at the primary who received the next highest number of votes cast for nomination to that office, equal in number to twice the number remaining to be elected to that office, or less, if the total number of candidates not elected is less.