

def min_subarray_size(arr, k):
    left = right = curr = best = 0
    while True:
        if curr >= k:
            curr -= arr[left]
            best = min(best, right - left) if best != 0 else right - left
            left += 1
        elif right == len(arr):
            break
        else:
            curr += arr[right]
            right += 1
    return best


if __name__ == '__main__':
    print min_subarray_size([2, 3, 1, 2, 4, 3], 7)
