def find_missing_integer(lst):
    """Returns the first missing integer in an ordered list.
    If not found, returns the next integer.
    """
    try:
        return sorted(set(range(lst[0], lst[-1])) - set(lst))[0]
    except:
        return max(lst) + 1