#include <bits/stdc++.h>
using namespace std;
bool containsK(int i, int k) {
  int check = 0;
  while (i > 0) {
    int curr = i % 10;
    if (curr != 0) {
      check++;
    }
    i /= 10;
  }
  return check == k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N, K;
  cin >> N >> K;
  int count = 0;
  for (int i = 1; i <= N; i++) {
    if (containsK(i, K)) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
