I would to determine the set of values $\lbrace a_1,a_2,a_3,\ldots,a_n \rbrace$ that minimizes the value of $x$ such that:

$$x\equiv a_1\mod p_1$$ $$\vdots$$ $$x\equiv a_n\mod p_n$$

where every value $a_i$ can assume $m_i<p_i-1$ values fixed a priori in $\lbrace1,\ldots,p_i-1 \rbrace$ (in my case $m_i\sim(p_i-1)/2$ and $p_i$ is the $i_{th}$ prime). Is there a better way than using the Chinese reminder theorem over all the possible combinations of $a_i$? What is the state-of-the-art algorithm for this problem?

Any help or reference would be appreciated. Thanks.

Edit: the possible sets $\lbrace a_1,a_2,a_3,\ldots,a_n \rbrace$ doesn't contain trivial solutions like $\lbrace 1,1,1,\ldots,1 \rbrace$.

Thanks for the answer. I noticed that my question is bad written and i try to explain better here through an example.

In my problem the possible values for every $a_i$ are only a subset of $\lbrace 1,\ldots,p_i-1\rbrace$ (containing $m_i<p_i-1$ different values of $\lbrace 1,\ldots,p_i-1\rbrace$) so no one could decide a priori if $p_{n+1}$ can be represented. For example: $$x\equiv a_1\mod 2,\qquad a_1\in\lbrace1\rbrace$$ $$x\equiv a_2\mod 3,\qquad a_2\in\lbrace1,2\rbrace$$ $$x\equiv a_3\mod 5,\qquad a_3\in\lbrace3,4\rbrace$$ $$x\equiv a_4\mod 7,\qquad a_4\in\lbrace1,6\rbrace$$

has the minimum solution $x=13$ for $a_1=1$, $a_2=1$, $a_3=3$, $a_4=6$. I found this solution through an exhaustive search over the $2^3$ combinations of $a_i$ values and I was wondering if the general case of this problem has been studied in literature and if there was a reference or an algorithm for this purpose.

In particular I faced a problem with about $100$ congruences, and every $a_i$ can take $m_i$ known and fixed values with $m_i\sim (p_i-1)/2$. I know the minimal solution is somewhere near $10^{100}$ but I don't know how to find it.