Company: AMAZON ML SUMMER SCHOOL_28june
Difficulty: medium
Problem Statement King Leo's kingdom has magical forests with trees that produce magical fruits of different power levels. These fruits are important for the kingdom because they are used for spells, healing, and other daily needs. However, for a very important ritual, they need at least 'K' fruits to have the same power level to be effective. King Leo asks his Royal Magician to help make this happen. The magician can use two spells. Enhancement Spell: Increases the power of the weakest fruit by one. Suppression Spell: Decreases the power of the strongest fruit by one. Your task is to figure out the least number of times the magician needs to use these spells to get at least K fruits to the same power level, ensuring the ritual's success and the kingdom's prosperity. Input Format The first line contains two space-separated integers N and K representing the total number of magical fruits and the required number of fruits with equal power, respectively. The second line contains N integer