Subarrays with counter instead of sum + call abs for comparing difference