def efficient(array: list, number: int) -> int:
    """Get minimum lenght subarray with sum % number == 0 efficiently"""
    array_lenght = len(array)
    min_len = array_lenght + 1
    last_prefix_idx = {0: -1}
    current_sum = 0
    for i in range(array_lenght):
        current_sum = (current_sum + array[i]) % number
        if current_sum in last_prefix_idx:
            lenght = i - last_prefix_idx[current_sum]
            if lenght < min_len:
                min_len = lenght
            last_prefix_idx[current_sum] = i

    return min_len