import java.io.*; import java.util.*; /** * This solution is incredibly brute force-y. Try * all strings of log(n) digits up to t and count it if the * representation gives a sum of n. * * @author Finn Lidbetter */ public class BruteRedundant { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" "); long n = Long.parseLong(s[0]); int t = Integer.parseInt(s[1]); System.out.println(brute(n, t)); } static long brute(long n, int t) { int log = 0; while ((1<