def invertSM(coorSM, maxS, maxM):
    """
    Invert S and M axes.

    :param coorSM: coordinate of vector for SM inverted axes.
    :param maxS: value representing end of estatic axis.
    :param maxM: value representing end of mobile axis.
    :return: SM coordinate on inverted SM axes.
    """
    return int(maxS + coorSM - maxM)