from sys import stdin N, M = map(int, stdin.readline().split()) X = list(map(int, stdin.readline().split())) Y = list(map(int, stdin.readline().split())) Y.sort() ymax = max(Y) #print(Y) def bintan(liste, cle): d = len(liste) g = -1 while d - g > 1: moy = g + (d - g) // 2 if liste[moy] >= cle: d = moy else: g = moy return d for hito in X: i = bintan(Y, hito) if hito >= ymax: print("infinity") elif i >= M: print("infinity") #i -= 1 #print(Y[i] - hito) else: print(Y[i] - hito)