In section 4.4 of the paper "Quantum algorithms for computing short discrete logarithms and factoring RSA integers", for an arbitrary set $\left\{ (j_i, k_i):1\le i\le s \right\}$ chosen from measured results $\left\{ (j_i, k_i):1\le i\le t \right\}$ ($t$ is the number of times the circuit is excecuted), the algorithm searches all possible $d$ that saitisfies $$\sqrt{d^2+\sum_{t\,=\,1}^{s}({\left\{ dj_i+2^mk_i \right\}_{2^{l+m}}\,)^2}} < \sqrt{s/4+1}\cdot 2^m$$ Note that $d$ is strictly bounded by $\sqrt{s/4+1}\cdot 2^m$. To do this the algorithm should go as follows:
Prepare an array $D:=\left\{ 0,\,...,\, B - 1 \right\}$, where $B$ is the ceiling of $\sqrt{s/4+1}\cdot 2^m$. Denote $d$ as the first element of $D$.
Choose an arbiyary set $S\subset\left\{ (j_i, k_i):1\le i\le t \right\}$ of size $s$.
Test whether $d$ and $S$ satisfy the above inequality. If test fails, then return to step 2 (this time choose a different $S$).
Test whether $d$ is the desired answer (i.e. whether $x\equiv g^{d}$). If test fails, then remove $d$ from $D$ and return to step 3.
Output $d$.
Here step 2 and 3 are meaningless and can be removed from these steps. In my understanding, if the integer can be factored into two primes, then there is no difference compared with an exhaustive search of $d$ from $0$ to $\sqrt{s/4+1}\cdot 2^m$ (where one exhaustive search of $d$ from $0$ to $2^m$ suffices to find an answer). In what part do I understand wrong in this section?