w = int(input()) d = int(input()) if d == 1: print(w) else: for i in range(d-1): w -= w//(d**2) d -= 1 print(w, d)