from typing import List


def string_to_integer_list(csv_list: str, length: int) -> List[int]:
    """
    Helper function to convert an array or list of integers saved as a list in a csv back to its original format.

    :param length: excepted length of converted list
    :param csv_list: list as string
    :return: converted list of integers
    """
    if not isinstance(csv_list, str):
        raise ValueError("conversion unsuccessful, please input a string")
    if "," in csv_list:
        delimiter = ','
    else:
        delimiter = " "
    integer_list = [int(s.strip()) for s in csv_list.strip("[]").split(delimiter) if s.strip().isdigit()]
    if len(integer_list) < length:
        raise ValueError("conversion unsuccessful")
    return integer_list