A dispatch belt carries n parcels, each with an integer priority. Relative to a pivot priority p, a stable three-way partition rearranges the parcels into three contiguous groups — those with priority below p, then those equal to p, then those above p — while preserving the original left-to-right order within each group. Output the parcels in their partitioned order.
Input format
Line 1: two integers n and p.
Line 2: n space-separated integers, the parcel priorities in belt order.
Output format
n space-separated integers on one line: the priorities after the stable three-way partition.
Constraints
- 1 ≤ n ≤ 100000
- -1000000000 ≤ p, each priority ≤ 1000000000