#include <bits/stdc++.h>
using namespace std;
bool panduan(long long a, int b) {
  int cnt = 0;
  for (;;) {
    if (a % 10) cnt++;
    if (cnt > b) return false;
  }
  return true;
}
int main() {
  long long a, cnt = 0;
  int b;
  cin >> a >> b;
  for (long long i = 0; i <= a; i++)
    if (panduan(a, b)) cnt++;
  cout << cnt << endl;
  return 0;
}
