import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); sc.close(); if (n < k) { System.out.println("INF"); return; } Set set = new HashSet(); for (int i = n; i <= n + k; i++) { if ((n & i) == n) { set.add(i); } } int ans = 0; Integer[] array = set.toArray(new Integer[0]); for (int i = 0; i < array.length; i++) { for (int j = i; j < array.length; j++) { if ((array[i] & array[j]) == n) { ans++; } } } System.out.println(ans); } }