The Stieltjes--Fekete problem and degenerate orthogonal polynomials