Given an array and a number K, find the minimum number of swaps needed to bring all the numbers less than K together.The problem can be solved using the sliding window approach.First, count the elements that are less than or equal to K.Then, find the minimum number of elements greater than K in a window of size equal to the count.