#include <bits/stdc++.h>
using namespace std;
int count(long long int N) {
  int A = 0;
  while (N > 0) {
    if (N % 10 != 0) {
      A++;
    }
    N = N / 10;
  }
  return A;
}
int main() {
  long long int N, K;
  cin >> N >> K;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (count(i + 1) == K) {
      ans++;
    }
  }
  cout << ans << endl;
}
