implement equal_to_sum like bsearch