(defparameter line (read-line))
(defparameter n (length line))
(defparameter k (read))
(defparameter dp (make-array (list n (1+ k) 2)))

(defun get-num (place)
  (- (char-code (aref line place)) (char-code #\0)))

(defun func2 (place use touch)
  (if (= place n)
    (if (= use k)
      1
      0)
    (if (aref dp place use touch)
      (aref dp place use touch)
      (setf (aref dp place use touch) (func place use touch)))))

(defun func (place use touch)
  (if (= use k)
    1
    (if (zerop touch)
      (+ (if (= use k) 0
           (* 9 (func2 (1+ place) (1+ use) 0)))
         (func2 (1+ place) use 0))
      (if (zerop (get-num place))
        (func2 (1+ place) use touch)
        (+ (func2 (1+ place) use 0)
           (* (1- (get-num place)) (func2 (1+ place) (1+ use) 0))
           (func2 (1+ place) (1+ use) 1))))))

(princ (func2 0 0 1))
