We can perform this in O(nlogK) time using heaps.
First, create a min-heap with first k+1 elements.Now, we are sure that the smallest element will be in this K+1 elements..Now,remove the smallest element from the min-heap(which is the root) and put it in the result array.Next,insert another element from the unsorted array into the mean-heap, now,the second smallest element will be in this..extract it from the mean-heap and continue this until no more elements are in the unsorted array.Next, use simple heap sort for the remaining elements.
Time Complexity---
O(k) to build the initial min-heap
O((n-k)logk) for remaining elements...
Thus we get O(nlogk)
Hence,B is the correct answer