N, M = map(int, input().split()) X = list(map(int, input().split())) Y = list(map(int, input().split())) s = [0 for i in range(1000)]+[1] for i in Y: s[i] = 1 for i in X: for j in range(i,1000): if s[j]==1: print(j-i) break else: print("Infinity")