compute k closest stars