int su = 0;
int m = Convert.ToInt32(Console.ReadLine());
int nonZeros = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i<m+1;m++)
    int num = i;
    int currNonZeros = 0;
    while(num!=0){
    	if (num % 10 != 0){
   		    currNonZeros += 1;
        }
    	num = Convert.ToInt32(num/10);
    }
    if (currNonZeros == nonZeros){
    	su += 1;
    }
Console.WriteLine(su);
    