# Arup Guha
# 11/10/2022
# Solution to 2021 WF Problem C: Fair Division

# Just calculates b to the e power...a speed up.
def mypow(b,e):

    res = 1
    term = b
    while e > 0:

        if e&1 == 1:
            res = res*term

        e >>= 1
        term *= term

    return res

# GCD...maybe I should just call the build in one =)
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

# Main function.
def main():
    toks = input().split()
    n = int(toks[0])
    m = int(toks[1])

    # Solve it.
    p,q = go(n,m)

    # Here is what they ask us to output.
    if p == -1:
        print("impossible")
    else:
        print(p,q)

# Solve it!
def go(n,m):

    # The fraction just doesn't work...
    if n > 70:
        return -1,-1
    
    # I guessed, but I think about 3000 is the upper bound because there
    # are at least 6 pirates...
    for q in range(2, 6000):

        # We are trying q first and we need this value.
        term = mypow(q,n-1)
        if m < term:
            break

        # We are okay to try it, so multiply by q.
        term *= q
        
        found = False
        
        # Try p...
        for p in range(q-1, 0,-1):

            # Not allowed.
            if gcd(q,p) != 1:
                continue

            # Calculate the desired fraction.
            sub = mypow(p,n)
            div = term-sub
            top = m*(q-p)

            # Has to be an integer...
            if div > top:
                continue

            found = True

            # This is our criteria for a solution.
            if top%div == 0:
                return q-p,q

        if not found:
            break

    # If we get here, no p,q worked...
    return -1,-1

# Run it!
main()
