Create max heap of size 100
calculate distance of first 100 points add it to the max heap, Now from here calculate distance from one by one and check weather we have to add it to the max heap or not we can do it by comparing top element with the current distance
if current distance < top element in max heap then remove top element in max heap and add current distance
else do nothing
loop the above if else condition for each of the million elements
Order:
Assuming there are n elements and we have to find top m elements then O(m+(n-m)logm) since m << n
Net order is O(nlogm)