#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<climits>
#include<vector>
#include<cstring>
#include<stack>
using namespace std;
#define REP(i,s,n) for (int i=(s),_n=(n);i<=_n;i++)
#define FOR(i,s,n) for (int i=(s),_n=(n);i<_n;i++)
#define REPD(i,e,s) for (int i=(e),_s=(s);i>=_s;i--)
#define tr(container, it) \
for (typeof(container.begin()) it=container.begin(); it!=container.end();it++)
#define PB push_back
typedef long long LL;
typedef vector<int> VI;
typedef pair<int,int> PI;
long long int ans=0;
int main() {
long long int a,b;
cin >>a >> b;
ans=a;
long long int cpy=a,t=0;
while(b>0)
{
if( a%10 ==9)
{
a/=10;
b/=10;
}
else
{
if(a%10+1 <=b)
{
cpy-=(a%10+1)* (long long int) (pow((long long int)10,t));
b-=a%10+1;
a-=a%10+1;
a/=10;
b/=10;
}
else
break;
}
t+=1;
}
cout<<cpy<<endl;
return 0;
}
I2luY2x1ZGU8Y3N0ZGlvPgojaW5jbHVkZTxpb3N0cmVhbT4KI2luY2x1ZGU8YWxnb3JpdGhtPgojaW5jbHVkZTxjbWF0aD4KI2luY2x1ZGU8Y3N0ZGxpYj4KI2luY2x1ZGU8cXVldWU+CiNpbmNsdWRlPG1hcD4KI2luY2x1ZGU8c2V0PgojaW5jbHVkZTxzdHJpbmc+CiNpbmNsdWRlPHNzdHJlYW0+CiNpbmNsdWRlPGNsaW1pdHM+CiNpbmNsdWRlPHZlY3Rvcj4KI2luY2x1ZGU8Y3N0cmluZz4KI2luY2x1ZGU8c3RhY2s+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBSRVAoaSxzLG4pICBmb3IgKGludCBpPShzKSxfbj0obik7aTw9X247aSsrKQojZGVmaW5lIEZPUihpLHMsbikgIGZvciAoaW50IGk9KHMpLF9uPShuKTtpPF9uO2krKykKI2RlZmluZSBSRVBEKGksZSxzKSAgZm9yIChpbnQgaT0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