Problems
К-th minimum
К-th minimum
Find the $k$-th number in array $A =~< a_1, a_2, ..., a_n >$ sorted in increasing order.
Array $A$ is generated with the polynom $P(x) = 132x^3 + 77x^2 + 1345x + 1577: a_i = P(i)~mod~1743$.
\InputFile
Two positive integers $n$ and $k~(1 \le k \le n \le 50000)$.
\OutputFile
Print the $k$-th number in sorted array $А$.
Input example #1
1 1
Output example #1
1388
Input example #2
2 2
Output example #2
1388