def xsi_tilde(deg_seq, s, value):
    """
    Subtract 1 from 's' elements of deg_seq, which equal to value by starting from the end of the sequence deg_seq
    :param deg_seq: degree sequence
    :param s: number of elements
    :param value:
    :return d: if deg_seq is non-increasing sequence, than the output sequence d is also in non-increasing order
    """
    d = deg_seq.copy()
    count = 0
    inx = 0
    while count < s:
        if d[-1 - inx] == value:
            d[-1 - inx] -= 1
            count += 1
        inx += 1

    return d