def minimum_shipping_capacity(weights, days):
    if not weights:
        return 0
    left, right = max(weights), sum(weights) + 1
    while left < right:
        mid = (left + right) // 2
        used, load = 1, 0
        for weight in weights:
            if load + weight > mid:
                used += 1
                load = 0
            load += weight
        if used <= days:
            right = mid
        else:
            left = mid + 1
    return left
