def deduce_loop_size(subject: int, public_key: int) -> int:
    """
    Deduce the loop size for ``public_key`` by transforming the ``subject``.

    :return: The loop size, or -1 if no success
    """
    value = 1
    for loop_ct in range(100000000):
        if value == public_key:
            return loop_ct
        value *= subject
        value %= 20201227
    return -1