def find_offset(a0, a1):
    """Return the number of steps for which the sequences ``a0`` and
    ``a1`` are identical.
    """
    offset = min(a0.shape[0], a1.shape[0])
    while not (a0[:offset] == a1[:offset]).all():
        offset -= 1
        if offset < 0:
            raise IndexError()
    
    return offset