// Problem: C. Really Big Numbers
// Contest: Codeforces - Educational Codeforces Round 23
// URL: https://codeforces.com/problemset/problem/817/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,s;
bool check(ll x){
ll sum=0,tmp=x;
while(x){
sum+=x%10;x/=10;
}
return abs(sum-tmp)>=s;
}
int main(){
cin>>n>>s;
ll l=1,r=2e18,ans=n;
//cout<<check(11)<<" "<<check(12)<<" "<<check(13)<<"\n";
while(l<=r){
ll mid=(l+r)/2;
if(check(mid)) ans=mid,r=mid-1;
else l=mid+1;
}
cout<<max(0ll,n-ans+1)<<endl;
return 0;
}