with the abc-formula we have that \(\displaystyle K\) consists of the numbers \(\displaystyle \frac{-b}{2a}\pm \frac{1}{2a}\sqrt{b^2-4ac}\)

To make sure \(\displaystyle K\) has the desired property we must have \(\displaystyle \sqrt{b^2-4ac}=p\sqrt{D}\) for some number \(\displaystyle p\in \mathbb{Z}\).

That is, \(\displaystyle b^2-4ac= p^2D\).

This number \(\displaystyle p^2\in \mathbb{Z}\) can ofcourse be freely chosen.

Then we must choose \(\displaystyle a,b,c\in\mathbb{Z}\) that satisfy this relation. Thus we must choose a \(\displaystyle b\in \mathbb{Z}\) such that

there exists a composite number \(\displaystyle ac\in\mathbb{Z}\) that satisfies \(\displaystyle b^2 = p^2D+4ac\)

wich is, the same as saying \(\displaystyle \frac{b^2-p^2D}{4}\) must be a composite number. Only then we can choose \(\displaystyle a,c\in \mathbb{Z}\) such that \(\displaystyle ac=\frac{b^2-p^2D}{4}\).

And we've found \(\displaystyle a,b,c\) such that \(\displaystyle K\) has the desired property.