Subarray having absolute sum greater than k

please explain what is the need of prefix array and what is th logic behind upper_bound here.