#include <bits/stdc++.h>
using namespace std;
void debug(long long x) { cout << 111 << " " << x << endl; }
const int mod = 1e9 + 7;
const int N = 100005;
long long n, m, k, tt;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  tt = 1;
  while (tt--) {
    cin >> n >> m;
    long long ans = m / 10 * 10;
    while (1) {
      long long res = ans;
      k = 0;
      while (res) k += res % 10, res /= 10;
      if (ans - k >= m) break;
      ans += 10;
    }
    cout << (0 > n - ans + 1 ? 0 : n - ans + 1);
  }
  return 0;
}
