Ranking arborescences in O(Km log n) time