import java.util.Scanner; 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; } int ans = 0; int start = Math.max(n - k, 0); for (int i = start; i <= n + k; i++) { for (int j = i; j <= i + k; j++) { if ((i & j) == n) { ans++; } } } System.out.println(ans); } }