def cut_indices_of(array, cut):
    """
    Calculates the indices of the elements on the given cut for the given matrix.
    Where a diagonal runs from top left to bottom right, a cut runs from bottom left to top right.

    :param array: 2D array
    :param cut: index of the cut (cut 0 is the single element of the top left)
    :return: the indices to retrieve the cut
    """
    if array.ndim != 2:
        raise RuntimeError("array should be 2D")

    h, w = array.shape

    if cut < 0 or cut >= w + h - 1:
        return range(0, 0), range(0, 0)

    cut_length = cut + 1 - max(0, cut - h + 1) - max(0, cut - w + 1)

    if cut < h:
        return range(cut, cut - cut_length, -1), range(0, cut_length)
    else:
        return range(h-1, h-cut_length-1, -1), range(cut - h + 1, cut - h + 1 + cut_length)