n, k = map(int, input().split()) if n < k: print('INF') exit() B = [] for i in range(18): if (n>>i)&1: continue else: if i <= 10: B.append(i) #print(B) m = len(B) ans = 0 import itertools for p in itertools.product(range(3), repeat=m): d = 0 for j in range(m): b = B[j] if p[j] == 0: continue elif p[j] == 1: d += 1<