Algorithm 1 Computation of

Step 1) Compute the threshold.

Step 2) Sort the sequence in ascending order along with the corresponding weights.

Step 3) Let m increase from to, is whose weight hold the inequality first.