import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getLine
    k <- getInt
    print $ count n k

count :: String -> Int -> Int
count _ 0 = 1
count (s : []) 1 = read [s]
count (s : []) _ = 0
count (s : ss) k = count ss (k - 1) + (read [s] - 1) * count (map (\_ -> '9') ss) (k - 1) + count (map (\_ -> '9') ss) k