Given an array `nums` of positive integers and a positive integer `target`, return the minimal length of a contiguous subarray whose sum is greater than or equal to target. If none exists, return 0.