Generalizes to not just =k queries but also >=k queries.