Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:  if the last digit of the number is non-zero, she decreases the number by one;  if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit). You are given an integer number $$$n$$$. Tanya will subtract one from it $$$k$$$ times. Your task is to print the result after all $$$k$$$ subtractions.It is guaranteed that the result will be positive integer number.

The first line of the input contains two integer numbers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^9$$$, $$$1 \le k \le 50$$$) — the number from which Tanya will subtract and the number of subtractions correspondingly.

Print one integer number — the result of the decreasing $$$n$$$ by one $$$k$$$ times. It is guaranteed that the result will be positive integer number.

NoteThe first example corresponds to the following sequence: $$$512 \rightarrow 511 \rightarrow 510 \rightarrow 51 \rightarrow 50$$$.

import java.util.Scanner;

public class WrongSubtraction {

    public static void main(String[] args) {

        Scanner skanneri = new Scanner(System.in);
        int numero = skanneri.nextInt();
        int kertaa = skanneri.nextInt();

        for(int i = 0; i < kertaa; i++)
        {
            if(numero % 10 == 0)
            {
                numero = numero / 10;
            }
            else
            {
                numero = (numero - 1);
            }
        }

        System.out.println(numero);
    }
}

import java.util.Scanner;

public class Solution
{

	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		String line = scanner.nextLine();
		String[] splitted = line.split(" ");
		int number = Integer.parseInt(splitted[0]);
		int times = Integer.parseInt(splitted[1]);
		while(times != 0)
		{
			times--;
			if (number % 10 != 0)
			{
				number--;
			}
			else
			{
				number /= 10;
			}
		}
		System.out.print(number);
	}

}

import java.io.*;
import java.util.*;

public class CF {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        for (int i = 0; i < k; i++) {
            if (n % 10 == 0) n /= 10;
            else n--;
        }
        System.out.println(n);
    }
}

// Welcome to CompileJava!

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
            Scanner s = new Scanner(System.in);
            int n = s.nextInt();
            int k = s.nextInt();
            for(int i=1;i<=k;i++)
            {
                if(n%10==0)
                    n/=10;
                else
                    n-=1;
            }
            System.out.println(n);
        }
    }

import java.io.*;
import java.util.*;

public class Vaibhav
{

	public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        while(k>0)
        {
        	//System.out.println("n : "+n+"  k : "+k);
            int sub = n % 10;
            if(sub==0)
            {
                k--;
                n=n/10;
            }
            else
            {
                if(k>sub)
                    k = k- sub ;
                else
                {
                    sub = k ;
                    k=0;
                }
                n=n-sub;
            }

        }
        System.out.println(n);

    }

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class WrongSubtraction {

  public static void main(String[] args) throws Exception {
    new WrongSubtraction().go();
  }

  PrintWriter out;
  Reader in;
  BufferedReader br;

  WrongSubtraction() throws Exception {

    // in = new Reader("input.txt");
    // out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );

    br = new BufferedReader(new InputStreamReader(System.in));
    in = new Reader();
    out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

  }

  void go() throws Exception {

    int t = 1;
    while (t > 0) {
      solve();
      t--;
    }

    //System.err.println(System.currentTimeMillis() - time);

    out.flush();
    out.close();
  }

  int inf = 2000000000;
  int mod = 1000000007;
  double eps = 0.000000001;

  int n;
  int m;

  void solve() throws Exception {

    int n = in.nextInt();
    int k = in.nextInt();

    while (k > 0) {

      if (n%10 == 0) n /= 10; else n--;
      k--;
    }

    out.println(n);
  }

  class Reader {

    BufferedReader  br;
    StringTokenizer tok;

    public Reader(String file) throws Exception {
      br = new BufferedReader( new FileReader(file) );
    }

    public Reader() throws Exception {
      br = new BufferedReader( new InputStreamReader(System.in) );
    }

    public String next() throws Exception {

      while (tok == null || !tok.hasMoreElements())
        tok = new StringTokenizer(br.readLine());
      return tok.nextToken();
    }

    public int nextInt() throws Exception {
      return Integer.valueOf(next());
    }

    public long nextLong() throws Exception {
      return Long.valueOf(next());
    }

    public double nextDouble() throws Exception {
      return Double.valueOf(next());
    }

    public String nextLine() throws Exception {
      return br.readLine();
    }

  }

  static class InputReader {

    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public InputReader() {
      din = new DataInputStream(System.in);
      buffer = new byte[BUFFER_SIZE];
      bufferPointer = bytesRead = 0;
    }

    public InputReader(String file_name) throws Exception {
      din = new DataInputStream(new FileInputStream(file_name));
      buffer = new byte[BUFFER_SIZE];
      bufferPointer = bytesRead = 0;
    }

    public String readLine() throws Exception {
      byte[] buf = new byte[64]; // line length
      int cnt = 0, c;
      while ((c = read()) != -1) {
        if (c == '\n') {
          break;
        }
        buf[cnt++] = (byte) c;
      }
      return new String(buf, 0, cnt);
    }

    public int nextInt() throws Exception {
      int ret = 0;
      byte c = read();
      while (c <= ' ') {
        c = read();
      }
      boolean neg = (c == '-');
      if (neg) {
        c = read();
      }
      do {
        ret = ret * 10 + c - '0';
      }  while ((c = read()) >= '0' && c <= '9');

      if (neg) {
        return -ret;
      }
      return ret;
    }

    public long nextLong() throws Exception {
      long ret = 0;
      byte c = read();
      while (c <= ' ') {
        c = read();
      }
      boolean neg = (c == '-');
      if (neg) {
        c = read();
      }
      do {
        ret = ret * 10 + c - '0';
      }
      while ((c = read()) >= '0' && c <= '9');
      return neg ? -ret : ret;
    }

    public double nextDouble() throws Exception {
      double ret = 0, div = 1;
      byte c = read();
      while (c <= ' ')
        c = read();
      boolean neg = (c == '-');
      if (neg)
        c = read();

      do {
        ret = ret * 10 + c - '0';
      }
      while ((c = read()) >= '0' && c <= '9');

      if (c == '.') {
        while ((c = read()) >= '0' && c <= '9') {
          ret += (c - '0') / (div *= 10);
        }
      }

      return neg ? -ret : ret;
    }

    private void fillBuffer() throws Exception {
      bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
      if (bytesRead == -1) {
        buffer[0] = -1;
      }
    }

    private byte read() throws Exception {
      if (bufferPointer == bytesRead) {
        fillBuffer();
      }
      return buffer[bufferPointer++];
    }

    public void close() throws Exception {
      if (din == null) {
        return;
      }
      din.close();
    }
  }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();
        for (int i = 0; i < k; i++)
        {
            if(n%10 ==0)
                n=n/10;
            else
                n--;
        }
        System.out.println(n);
    }
}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        for (int i = 0;i<k;i++) {
            if (n % 10 != 0) n = n -1;
            else {
                n =n/10;
            }
        }
        System.out.println(n);
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforce;

import java.util.Scanner;

/**
 *
 * @author 123
 */
public class CodeForce {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
//
        int a;
        short b;

        a = s.nextInt();
        b = s.nextShort();

        for (int i = 1; i <= b; i++) {
            if (a % 10 == 0) {
                a = a / 10;
            } else {
                a = a - 1;
            }
        }
        System.out.print(a);
//
//        String in, sh, f = null;
//        int counter = 0, b;
//        b = s.nextInt();
//        in = s.next();
//
//        for (int i = 0; i < b - 1; i++) {
//            int c = 0;
//            sh = in.substring(i, i + 2);
//            for (int j = 0; j < b - 1; j++) {
//                if ((sh).equals(in.substring(j, j + 2))) {
//                    c++;
//                }
//                if (c > counter) {
//                    counter = c;
//                    f = sh ;
//                }
//            }
//
//        }
//        System.out.print(f);
//
//         short i , a = s.nextShort();
//         boolean flag = false;
//         for (i = 0; i < a; i++) {
//            byte q = s.nextByte();
//            if (q==1)
//                flag = true;
//        }
//         if (flag)
//             System.out.print("HARD");
//         else
//             System.out.print("EASY");ذ

//        int limak, bob, i=1;
//        limak = s.nextInt();
//        bob = s.nextInt();
//        for (;; i++) {
//            limak = limak * 3;
//            bob = bob * 2;
//
//            if (limak > bob) {
//                break;
//            }
//        }
//        System.out.print(i);

//        int students = s.nextInt(), hight = s.nextInt(), counter = 0, input;
//        for (int i = 0; i < students; i++) {
//            input = s.nextInt();
//            if (input <= hight) {
//                counter = counter+1;
//            } else {
//                counter = counter+2;
//            }
//        }
//        System.out.println(counter);
//        int n = s.nextInt(), f = s.nextInt(), t = s.nextInt(), max = 0;
//
//        if (n + f + t > max) {
//            max = n + f + t;
//        }
//        if (n * f + t > max) {
//            max = n * f + t;
//        }
//        if (n * (f + t) > max) {
//            max = n * (f + t);
//        }
//        if (n + f * t > max) {
//            max = n + f * t;
//        }
//        if ((n + f) * t > max) {
//            max = (n + f) * t;
//        }
//        if (n * f * t > max) {
//            max = n * f * t;
//        }
//
//        System.out.println(max);

//        int students = s.nextInt(), m_sum = 0 , sum, grade = 0 , t = 1;
//
//        for (int i = 0; i < 4; i++) {
//            grade = s.nextInt();
//            m_sum +=grade;
//        }
//        for (int i = 2; i <= students; i++) {
//            sum = 0;
//            for (int j = 1; j <= 4; j++) {
//               grade = s.nextInt();
//               sum += grade;
//            }
//            if (sum > m_sum) {
//                t ++;
//            }
//        }
//        System.out.println(t);
    }

}

import java.util.*;

public class Solution
{
       public static void main(String []args)
       {
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int k = sc.nextInt();
       for(int i = 1 ; i <= k ; i++)
       {
              if(n % 10 == 0)
              n = n/10;

              else
              n--;
       }
       System.out.println(n);
       }
}

import java.util.Scanner;

public final class Tayna{

    public static void main(String[] args){
        Scanner key = new Scanner(System.in);

        wrongSub(key.nextInt(), key.nextInt());

    }

    public static void wrongSub(int a, int b){

        int ret = a;

        for(int i = 0; i < b; i++){

            //b--;
            if(ret%10 == 0)
                ret /= 10;

            else
                ret--;

        }

        System.out.println(ret);

    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        for (int i = 0; i < k; i++) {
            if (n % 10 == 0) {
                n /= 10;
            } else {
                n--;
            }

        }
        System.out.println(n);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Solution {

	public static void main(String[] args) {
		 int n,k;
		 Scanner sc = new Scanner(System.in);
		 n = sc.nextInt();
		 k = sc.nextInt();
		 System.out.print(wrongSustraction(n, k));
	}

	static int wrongSustraction(int n,int k) {
        int i = 0;
		while(i<k) {
			if(n % 10 == 0 && n>=10){
				n/=10;
			}
			else{
				n--;
			}
			i++;
		}
		return n;
	}

}

import java.util.Scanner;

public class JavaApplication3 {
    private Integer n ;
    private Integer k ;
    private String s ;

    //---------------

    //---------------------
    public int resolveProblem (int n,int k)
    {

        while ( k> 0)
        {
            s = String.valueOf(n);
            if (Integer.parseInt((String) s.subSequence(s.length()-1,s.length()))!= 0)
            {
                n = n -1 ;
            }
            else
            {
                n = n /10;
            }
            k-- ;
        }
        return n ;
    }
    public static void main (String [] args)
    {

        JavaApplication3 mainClass = new JavaApplication3();
       Scanner in = new Scanner(System.in);
       int n=in.nextInt();
         int k=in.nextInt();
        System.out.println(mainClass.resolveProblem(n,k));
    }
}

import java.util.*;
public class Main {

    public static void main(String[] args) {

         int n, k;

         Scanner ob1 = new Scanner(System.in);

         n = ob1.nextInt();
         k = ob1.nextInt();

         for(int i=1;i<=k;i++)
         {
             if(n%10==0)
             {
                 n=n/10;
          }
             else
             {
                 n=n-1;
             }

         }
         System.out.println(n);

    }

}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		int t = sc.nextInt();
		for(int i =1 ;i<=t;i++)
		{
			long n1 = n%10;
			if(n1!=0)
			{
				n = n-1;
			}

			else
			{
				n = n/10;
			}
		}

		System.out.print(n);
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class PracticeCF {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long k=sc.nextLong();

		while(k-->0)
		{
		if(n%10!=0)
		{
			n=n-1;
		}
		else
		{
			n=n/10;
		}
		}
		System.out.println(n);
	}

}

import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        for(int i=0;i<k;i++)
        {
            if(n%10==0)
                n/=10;
            else
                n--;
        }
        System.out.print(n);

    }
}

import java.util.*;
import java.util.Scanner;
public class A{
    public static void main(String[] args){
          Scanner q = new Scanner(System.in);

        int n = q.nextInt(), k = q.nextInt(), rez = 0;
        for(int i = 0; i < k; i++) {
            if (n % 10 == 0) {
                n /= 10;
            }
            else{
                n--;
            }
        }
        System.out.println(n);

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Solution{
    public static void main(String[] args) {

        Scanner scan= new Scanner(System.in);

        int number= scan.nextInt();
        int sub= scan.nextInt();

        for(int i=0; i<sub; i++){
            if(!(number % 10 == 0))
                number= number - 1;
            else
                number= number / 10;
        }
        System.out.println(number);
    }
}
//131203 11

import java.io.*;
import java.util.*;
public class vishal
{
  public static boolean lasdig(int num)
  {
    int r = num%10;
    if(r==0)
    return true;
    return false;
  }
  public static void main(String[] args) throws IOException
  {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int k = in.nextInt();
    while(k>0)
    {
      if(lasdig(n)==true)
      n=n/10;
      else
      n-=1;
      k--;
    }
    System.out.print(n);
  }
}

//package A;
import java.util.*;
import java.io.*;
public class A479 {

	public static void main(String[] args) throws java.lang.Exception
	{
		R.init(System.in);
		String s=R.N();
		int n=Integer.parseInt(s);
		int k=R.NI();

		while(k!=0)
			{
				if(n%10==0)
				{
					n=n/10;
					k--;
				}
				else
				{
					n--;
					k--;
				}
			}
			System.out.println(n);

	}
}
class R {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	/** call this method to initialize reader for InputStream */
	static void init(InputStream input) {
		reader = new BufferedReader(
				new InputStreamReader(input) );
		tokenizer = new StringTokenizer("");
	}

	/** get next word */
	static String N() throws IOException {
		while ( ! tokenizer.hasMoreTokens() ) {
			//TODO add check for eof if necessary
			tokenizer = new StringTokenizer(
					reader.readLine() );
		}
		return tokenizer.nextToken();
	}

	static int NI() throws IOException {
		return Integer.parseInt( N() );
	}
	static long NL() throws IOException {
		return Long.parseLong( N() );
	}
}

import java.util.Scanner;

public class NewClass {

	static Scanner s1 = new Scanner(System.in);
	public static void main(String[] args) {

		System.out.println(WrongSubtraction( s1.nextInt(), s1.nextInt()));
	}

	public static int WrongSubtraction(int number, int index) {

		for (int i = 0; i < index; i++) {
			if ((number % 10) == 0)
				number /= 10;
			else
				number -= 1;
		}
		return number;
	}

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        for (int i = 0; i < k; i++) {
            if (n % 10 != 0)
                n--;
            else
                n = n / 10;
        }
        System.out.println("\n" + n);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class WrongSubstraction {

	private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException {

		String inputLine = br.readLine();
		String[] inputs = inputLine.split(" ");
		int num = Integer.parseInt(inputs[0].trim());
		int k = Integer.parseInt(inputs[1].trim());

		System.out.println(solve(num,k));

		System.exit(0);
	}

	private static int solve(int N, int k) {

		while(k!=0&&N!=0) {
			int lastdigit = N%10;

			if(lastdigit<=k&&lastdigit!=0) {
				N -= lastdigit;
				k -= lastdigit;
			}
			else if(lastdigit==0) {
				N = N/10;
				k--;
			}
			else if(lastdigit>k) {
				N = N-k;
				k = 0;
			}

		}

		return N;

	}

}

import java.util.*;
import java.lang.*;

// "static void main" must be defined in a public class.
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		while(t-- > 0 && n > 0) {
			if(Math.abs(n) % 10 == 0) {
				n /=10;
			} else {
				n--;
			}
		}

		System.out.println(n);
		sc.close();
    }
}

import java.util.Scanner;
public class CompProg {
	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int k = s.nextInt();

		for(int i = 0; i < k; i++) {
			if(n % 10 == 0) {
				n /= 10;
			} else {
				n--;
			}
		}
		System.out.println(n);
	}
}

import java.util.*;

public class wrongSubtraction {

	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int n = s.nextInt();
	int k = s.nextInt();
	while(k-- >0){
		if(n%10 != 0) {
			n--;
		}else {
			n = n/10;
		}
	}
	System.out.println(n);
	s.close();

	}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner (System.in);

        int n = scan.nextInt();
        int k = scan.nextInt();

        for(int i =0; i < k; i++){

            if (n == 0) {
                break;
            }
            else if (n % 10 == 0) {
                n = n/10;
            }
            else n--;

        }
        System.out.println(n);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class WrongSubtraction {
    public static void main(String[] args) throws IOException, NumberFormatException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");

        int n = Integer.parseInt(input[0]);
        int k = Integer.parseInt(input[1]);
        for (int i = 0; i < k; ++i) {
            if (n % 10 == 0)
                n /= 10;
            else
                --n;
        }
        System.out.println(n);
    }
}

import java.util.Scanner;

public class ProblemA {
	static final Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int num = sc.nextInt();
		int subtractions = sc.nextInt();

		int result = afterSubtractions(num, subtractions);
		System.out.print(result);
	}

	static int afterSubtractions(int num, int subtractions) {
		int result = num;
		while (subtractions > 0) {
			subtractions -= 1;
			result = subtractOnce(result);
		}
		return result;
	}

	static int subtractOnce(int num) {
		if (num % 10 == 0) {
			return num / 10;
		}
		else {
			return num - 1;
		}
	}
}

import static java.lang.Math.pow;
import java.util.Scanner;

public class First_problem {

    public static void main(String[] args) {

        int n,k ;
        Scanner scan = new Scanner(System.in);
        n=scan.nextInt();
        k=scan.nextInt();
        if(n>=2&&n<=pow(10,9)&&k>=1&&k<=50){
            for (int i = 0; i < k; i++) {
                if(n%10==0){
                    n=n/10;
                }
                else{
                    n=n-1;
                }

            }
            System.out.println(n);
        }
    }

}

import java.io.*;
import java.util.*;

public class Solution
{
	public static void main(String [] args)throws IOException
	{
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Scanner sc = new Scanner(System.in);
		int no_of_test_case,i;
		//no_of_test_case = Integer.parseInt(br.readLine())
		no_of_test_case = 1;

		for(i=0;i<no_of_test_case;i++)
			solution(i+1);

	}
	public static void solution(int tc)
	{
		Scanner sc = new Scanner(System.in);
		int i;
		int n = sc.nextInt();
		int k = sc.nextInt();

		for(i=0;i<k;i++)
		{
			if(n%10==0)
				n/=10;
			else
				n-=1;
		}

		System.out.println(n);
	}
}

import java.util.Scanner;

public class IncorrectSubtraction {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int minuend = scanner.nextInt();
        int countOfSubtractions = scanner.nextInt();
        int result = 0;
        for (int i = 0; i < countOfSubtractions; i++) {
            if (minuend % 10 == 0) {
                minuend /= 10;
                result = minuend;
            } else result = --minuend;
        }
        System.out.println(result);
    }
}

import java.util.Scanner;

public class Codeforces {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        System.out.println(wrongSubtraction(n,k));
    }

    static int wrongSubtraction(int n,int k)
    {
        for(int i=0;i<k;i++)
        {
            int lastDigit = n%10;
            if(lastDigit == 0)
                n/=10;
            else
                n--;
        }
        return n;
    }

}

// package Div3;

import java.util.*;

public class WrongSubtraction{

  // static int subtract(int num, int k){
  //
  //
  //
  //   for(int i = 0 ; i < k; i++){
  //     if(num%10 != 0){
  //       num = num - 1;
  //
  //     }
  //     else{
  //       num = num/10;
  //     }
  //
  //
  //   }
  //     //subtract 1 from num k times;
  //
  //
  //
  //   return num;
  // }

  public static void main(String[] args) {
    // System.out.println("Hello

    Scanner sc = new Scanner(System.in);
    // sc.nextLine();
    int num = sc.nextInt();
    int k = sc.nextInt();

    for(int i = 0 ; i < k; i++){
          if(num%10 != 0){
            num = num - 1;

          }
          else{
            num = num/10;
          }

    }
    System.out.println(num);
    return ;
  }
}

import java.util.Scanner;

public class Main  {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        wrongSubtraction(n, k);
    }

    private static void wrongSubtraction(int number, int k) {
        while (k > 0) {
            if (number % 10 == 0) {
                number = number / 10;
            } else {
                number--;
            }
            k--;
        }
        System.out.println(number);
    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        String n = in.next();
        String k = in.next();

        for (int i = 0; i < Integer.parseInt(k); i++){
            if(n.toCharArray()[n.length() - 1] == '0'){
                n = n.substring(0, n.length() - 1);
            }else{
                n = String.valueOf(Integer.parseInt(n) - 1);
            }
        }

        out.println(n);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) { arr[i] = nextInt(); }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) { arr[i] = nextLong(); }
            return arr;
        }

    }
}

import java.util.Scanner;
/**
 *
 * @author ASUS
 */
public class Subtraction {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
         for(int i=0;i<k;i++)
         {
             if(n%10==0)
                 n/=10;
             else
                 n-=1;

         }
           System.out.println(n);

    }

}

import java.util.*;

public class WordSubtraction_977A {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split("\\s");
		// sc.nextLine();
		long value = Long.parseLong(str[0]);
		int k = Integer.parseInt(str[1]);
		outloop:
		for (int i = 1; i <= k; i++) {
			int last = (int) value % 10;
			if (last > 0) {
				while (last > 0) {
					value = value - 1;
					//System.out.println(value +" " +i);
					i++;
					--last;
					if(i == k+1) {
						break outloop;
					}
				}
				i--;
			} else {
				value = value / 10;
				//System.out.println(value+" "+i);
			}
		}

		System.out.println(value);
	}
}

//package wrongsubtraction;
//https://codeforces.com/problemset/problem/977/A

import java.util.Scanner;

public class WrongSubtraction {
    public static void main (String[] args){
        Scanner r = new Scanner(System.in);

        int number = r.nextInt();
        int subtractions = r.nextInt();

        while (subtractions>0){
            if(number%10==0){
                number/=10;
            }
            else{
                number--;
            }
            subtractions--;
        }
        System.out.println(number);
    }
}

import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
	Scanner s=new Scanner(System.in);
	int x=0;
	int y=s.nextInt();
	int z=s.nextInt();
	while(x<z){
	    if(y%10==0){
	    y/=10;
	    x++;}
	    else if(y%10!=0){
	    y-=1;
	    x++;}
	}
		System.out.println(y);
	}
}

import java.util.Scanner;

public class WrongSubtraction {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        for (int i = 0; i < k ; i++) {
            if (n % 10 != 0){
                n-=1;
            }
            else{
                n/=10;
            }
        }
        System.out.println(n);
    }
}

/*package codeforces;

import java.util.*;
import java.io.*;

public class WrongSubtraction {

	public static void main(String[] args) throws IOException, FileNotFoundException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader in = new BufferedReader(new FileReader("WrongSubtraction.in"));
		StringTokenizer st = new StringTokenizer(in.readLine());
		int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		in.close();

		// CALCULATION //

		for (int i = 0; i < k; i++) {
            if (n % 10 == 0) n /= 10;
            else n--;
        }

		// OUTPUT //
		System.out.println(n);

	}

}*/

/* while (true) {
			if (n % 10 == 0) {
				n /= 10;
				k--;
			}
			else {
				int z = n%10;
				n -= z;
				k -= z;
				if (k<0) {
					n-=k;
					break;
				}
			}
			if (k == 0) break;
 		}
 		*/

import java.util.*;
public class Main
{
	public static void main(String[] args) {

	     Scanner in = new Scanner(System.in);
	       int n = in.nextInt();
	    int t = in.nextInt();
	     while(t-- >0){

	   if (n  % 10 == 0)
	   {
	       n = n/10;
	   }

		else
		{
		    n--;
		}
	}

	System.out.println(n);  // 131203 11
}
}

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int k = scan.nextInt();
		int n = scan.nextInt();

		for (int i = 0; i < n; i++) {
			if (k % 10 == 0) {
				k /= 10;
			}
			else {
				k--;
			}
		}

		System.out.println(k);

	}
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 *
 * @author pc
 */
public class Excercices {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();

        int n = sc.nextInt();

        int k = sc.nextInt();

        for(int i = 0; i <k; i++){
            if(n%10==0){
                n=n/10;
            }
            else{
                n--;
            }
        }

        System.out.println(n);

    }

    public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

}

import java.util.Scanner;

public class a977 {
    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        for (int i = k; i > 0; i--) {
            if (n % 10 == 0) {
                n = n / 10;
            } else {
                n = n - 1;
            }
        }
        System.out.println(n);
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        for (int i = 0; i < k; i++) {
            if (n % 10 != 0)
                n--;
            else
                n = n / 10;
        }
        System.out.println("\n" + n);
    }
}

import java.util.Scanner;
public class codeforces1
{
public static void main(String args[])
{
Scanner e=new Scanner(System.in);
int n=e.nextInt();
int k=e.nextInt();
for(int i=1;i<=k;i++)
{
if(n%10==0)
n/=10;
else
n-=1;
}
System.out.println(n);
}
}

import java.util.Scanner;

public class CF977A {
	static final Scanner sc = new Scanner(System.in);

	static int tanyaSubtractions(int num, int subtractions) {
		while (subtractions > 0) {
			if (num % 10 == 0) {
				num /= 10;
			}
			else {
				num -= 1;
			}
			subtractions -= 1;
		}
		return num;
	}

	public static void main(String[] args) {
		int num = sc.nextInt();
		int sub = sc.nextInt();
		int afterSubtraction = tanyaSubtractions(num, sub);
		System.out.print(afterSubtraction);
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */

public class Main
{

    static PrintWriter out;

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out);
		}
		String next(){
			while(st==null || !st.hasMoreElements()){
				try{
					st= new StringTokenizer(br.readLine());
				}
				catch (IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

// SHIVAM GUPTA :

// ASCII = 48 + i ;

// SHIVAM GUPTA :

public static int  min(int a ,int b , int c, int d)
{

       int[] arr = new int[4] ;
       arr[0] = a;
       arr[1] = b ;
       arr[2] = c;
       arr[3] = d;
       Arrays.sort(arr) ;

       return arr[0];

}

public static int  max(int a ,int b , int c, int d)
{

       int[] arr = new int[4] ;
       arr[0] = a;
       arr[1] = b ;
       arr[2] = c;
       arr[3] = d;
       Arrays.sort(arr) ;

       return arr[3];

}

static int sieve =  1000000 ;

static boolean[] prime =  new boolean[sieve + 1] ;

public static void sieveOfEratosthenes()
    {
        // FALSE == prime

        // TRUE ==  COMPOSITE

        // FALSE== 1

        for(int i=0;i< sieve + 1;i++)
            prime[i] = false;

        for(int p = 2; p*p <= sieve; p++)
        {

            if(prime[p] == false)
            {

                for(int i = p*p; i <= sieve; i += p)
                    prime[i] = true;
            }
        }

    }

public static String reverse(String input)
{
    String op = "" ;

    for(int i = 0; i < input.length() ; i++ )
    {
        op = input.charAt(i)+  op ;
    }

return op ;
}

public static int[] sortI(int[] arr)
{
      Arrays.sort(arr) ;
      return arr ;
}

public static int[] sortD(int[] arr)
{
      Arrays.sort(arr) ;

      int i =0 ; int j = arr.length -1  ;

      while( i < j)
      {
            int temp = arr[i] ;
            arr[i] =arr[j] ;
            arr[j] = temp ;
            i++ ; j-- ;
      }

      return arr ;
}

public static boolean sameParity(long a  ,long b )
{

      if(a%2 == b %2)
      {
            return true  ;
      }
      else{
            return false  ;
      }
}

public static boolean isPossibleTriangle(int a  ,int b , int c)
{
      if( a + b > c && c+b > a && a +c > b)
      {
            return true  ;
      }

      return false  ;

}

public static int gcd(int a, int b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

public static int lcm(int a, int b ,int c , int d )
{

int temp = lcm(a,b , c) ;

 int ans = lcm(temp ,d ) ;

return ans  ;

}

public static int lcm(int a, int b ,int c )
{

int temp = lcm(a,b) ;

int ans =  lcm(temp ,c) ;

return ans  ;

}

public static int lcm(int a , int b )
{

int gc = gcd(a,b);

return (a*b)/gc ;

}

static boolean isPrime(int n)
{
      if(n==1)
      {
            return false  ;
      }

      boolean ans =  true  ;

      for(int i = 2; i*i <= n ;i++)
      {
            if(n% i ==0)
            {
                  ans = false  ;break ;
            }
      }

      return ans  ;

}

public static ArrayList<Integer> allFactors(int n)
{
      ArrayList<Integer> list = new ArrayList<>() ;

    for(int i = 1; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}

public static boolean isPowerOfTwo(int n)
{
    if(n==0)
    return false;

if(((n ) & (n-1)) == 0 ) return true ;
else return false  ;

}

    public static int countDigit(long n)
    {
        return (int)Math.floor(Math.log10(n) + 1);
    }

   static final int MAXN = 100001;

    static int spf[] = new int[MAXN];

    static void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)

            spf[i] = i;

        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {

            if (spf[i] == i)
            {

                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

// The above code works well for n upto the order of 10^7.
// Beyond this we will face memory issues.

// Time Complexity: The precomputation for smallest prime factor is done in O(n log log n)
// using sieve.
// Where as in the calculation step we are dividing the number every time by
// the smallest prime number till it becomes 1.
// So, let’s consider a worst case in which every time the SPF is 2 .
// Therefore will have log n division steps.

// Hence, We can say that our Time Complexity will be O(log n) in worst case.

    static Vector<Integer> getFactorization(int x)
    {
        Vector<Integer> ret = new Vector<>();
        while (x != 1)
        {
            ret.add(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }

   public static void help(int[] arr ,int si , int ei)
   {
         if(arr[si] == arr[si+1] || arr[ei] == arr[ei-1] )
         {
               return ;
         }

         if(arr[si] < arr[si+1] && arr[ei-1] < arr[ei] )
         {
               arr[si+1] = -1*arr[si+1] ;
               return ;
         }

         else if(arr[si] > arr[si+1] && arr[ei-1] > arr[ei])
         {
              arr[si+1] = -1*arr[si+1] ;
               return ;
         }
         else{
               return ;
         }

   }

public static void main (String[] args) throws java.lang.Exception
{
  FastReader scn = new FastReader() ;
int n = scn.nextInt() ;
int k = scn.nextInt() ;

for(int i = 1; i <= k ; i++)
{

if(n % 10 == 0)n =  n/10 ;
else n = n-1  ;

}

out.println(n) ;

out.flush() ;

}

}

 class Pair implements Comparable<Pair>
{
  int val ;

  String str  ;

Pair(int val , String str)
{
      this.val = val ;
      this.str = str  ;
}

  public int compareTo(Pair o)
    {
        return this.val - o.val;
    }

}

import java.util.Scanner;
public class Main{
	public static void main(String [] args){
		String [] Input = new Scanner(System.in).nextLine().split(" ");

		int Number = Integer.valueOf(Input[0]);
		int Iteration = Integer.valueOf(Input[1]);
		for(int Count = 0; Count < Iteration; Count++){
			if(Number%10 != 0){
				Number--;
			}
			else{
				Number /= 10;
			}
		}
		System.out.println(Number);
	}
}

import java.util.Scanner;
public class CompProg {
	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		int n, k;
		n = s.nextInt();
		k = s.nextInt();

		for(int i = 0; i < k; i++) {
			if(n % 10 == 0) {
				n /= 10;
			} else {
				n--;
			}
		}
		System.out.println(n);
	}
}

import java.util.Scanner;

public class WrongSubtraction {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, k;
        n = sc.nextInt();
        k = sc.nextInt();
        for (int i = 1; i <= k; i++) {
            if (n % 10 != 0) {
                n--;
            } else {
                n = n / 10;
            }
        }
        System.out.println(n);
    }

}

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Scanner;
public class rrr {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = "" + n;
        char h[] = s.toCharArray();
        int b[] = new int [h.length];
        for (int i = 0; i < b.length; i++) {
            b[i] = h[i] - '0';
        }
        for (int i = b.length - 1; i >= 0; i--) {
            if (k <= b[i]) {
                b[i] -= k;
                for (int j = 0; j < i; j++) {
                    pw.print(b[j]);
                }
                    pw.print(b[i]);
                break;
            }else{
                k-= b[i] + 1;
                b[i] = 0;
            }
        }
        pw.close();
    }
}

import java.util.*;

public class Solution{

    public static void main(String[] args){

    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    int k =sc.nextInt();

    for(int i=0;i<k;i++){

        if(n%10==0){
            n=n/10;

        }
        else{
            n--;
        }
    }

    System.out.println(n);
}

}

//package Codeforces.Div3.Round_479.A_Wrong_Subtraction;

//import Common.OutputVerifier;

import java.io.*;
import java.util.*;

public class A_Wrong_Subtraction {

    public static void main(String[] args) throws IOException {

        boolean fileInOut = A_Wrong_Subtraction.class.getPackage() != null;

        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(fileInOut ? A_Wrong_Subtraction.class.getResourceAsStream("in.txt") : System.in)));
        Solution.out = new PrintWriter(new BufferedOutputStream(fileInOut ? new FileOutputStream("out.txt") : System.out), true);

        int testCase = fileInOut ? sc.nextInt() : 1;

        for (int i = 0; i < testCase; i++) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            new Solution().solution(n, k);
        }

        if (fileInOut) {
            //OutputVerifier.verify(A_Wrong_Subtraction.class.getResource("ans.txt").getFile());
        }
    }
}

class Solution {

    public static PrintWriter out;

    public void solution(int n, int k) {
        for (int i = 0; i < k; i++) {
            n = (n%10 == 0) ? n/10 : n-1;
        }
        out.println(n);
    }
}

import java.util.*;

public class wrongSubtraction {

	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int n = s.nextInt();
	int k = s.nextInt();
	while(k-- >0){
		if(n%10 != 0) {
			n--;
		}else {
			n = n/10;
		}
	}
	System.out.println(n);
	s.close();

	}
}

import java.util.*;

public class Main {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int num = sc.nextInt();
       int k = sc.nextInt();
       System.out.println(solve(num,k));
    }
    private static int solve(int num, int k) {
        for(int i=0;i<k;i++) {
            if(num % 10 == 0) {
                num /= 10;
            }
            else {
                num -=1;
            }
        }
        return num;
    }
}

import java.util.Scanner;

public class Cp {
    public static int f1(int n,int k){
        if (k==0){
            return n;
        }
        if(n%10==0){
            n/=10;
            k--;
        }
        else{ n--;
            k--;
            }
        return f1(n,k);

    }

    public static void main(String [] arg) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int f = 0;
        try {
            f = f1(n, k);
        } catch (Exception e) {
            System.out.println("error");
        }
        System.out.println(f);

    }
}

    import java.util.*;
    public class MyClass {
        public static void main(String args[]) {
          Scanner sc = new Scanner(System.in);
          int n = sc.nextInt();
          int k = sc.nextInt();
          /*while(n % 10 == 0) {
              n = n / 10;
          }*/
            int i = 0;
            while(k > 0) {
                if(n % 10 == 0) {
                    n = n / 10;
                } else {
                    n = n - 1;
                }
                k--;
            } System.out.println(n);

        }
    }

import java.util.*;

public class Main {
	public static void main (String[] args) {
		int n, k;

		Scanner scanner = new Scanner(System.in);
		String input = scanner.nextLine();
		String[] numbers = input.split(" ");

		n = Integer.parseInt(numbers[0]);
		k = Integer.parseInt(numbers[1]);

		for(int i = 0; i < k; i++){
			if((n % 10) == 0)
				n /= 10;
			else
				n--;
		}
		System.out.print(n);
	}
}

//import Codeforces.CodeforcesLibrary; // it will be error - add methods to this class as static methods

import javafx.util.Pair;

import java.util.*;

public class TestCodeforces {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        solve(scanner);
        scanner.close();
    }

    public static void solve(Scanner scanner) {
        int x = scanner.nextInt(), c = scanner.nextInt();
        int res = 0;
        while (c -- > 0) {
            if ((x % 10 != 0)) x -= 1;
            else x /= 10;
        }
        System.out.println(x);

    }

}

import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        int i=0;
        while(i<k){
            if(n%10==0){
                n=n/10;
            }
            else{
                n=n-1;
            }
            i++;
        }
        System.out.println(n);
    }
}

import java.util.Scanner;

public class a {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();

        for(int i = 1; i <= k; ++i) {
            if (n % 10 != 0) {
                --n;
            } else {
                n /= 10;
            }
        }

        System.out.println(n);
        return;
    }

    public static long f(long x){
        long temp =  x + 1;
        while (temp %10 == 0 ){
            temp =  temp / 10 ;
        }
        return temp;
    }
}

import java.util.*;

public class A {
	public static void main(String[] args){

		Scanner scanner = new Scanner(System.in);

    	int res =scanner.nextInt();
        int n = scanner.nextInt();

        for(int i =0;i<n;i++){
            if(res%10==0)res/=10;
            else res--;
        }

		System.out.println(res);
	}
}

import javax.management.DynamicMBean;
import java.util.*;

public class TestCodeforces {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt(), k = scanner.nextInt();

        while (k-- > 0) {
            int d =  n % 10;
            if (d != 0) n--;
            else n /= 10;
        }
        System.out.println(n);

        scanner.close();

    }

}

import java.util.Scanner;

public class main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),k=sc.nextInt();
        while (k!=0){
            if (n%10==0){
                n/=10;
            }else {
                n--;
            }
            k--;
        }

        System.out.println(n);
    }
}

import java.util.Scanner;
public class tc {
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		for(int i=0;i<k;i++)
		{
			if(n%10==0)
			{
				n=n/10;
			}
			else {
				n--;
			}
		}
		System.out.print(n);
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main977A {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String lines[] = in.readLine().split(" ");
        int sum = Integer.parseInt(lines[0]);
        int times = Integer.parseInt(lines[1]);
        for (int i = 0; i < times; i++) {

            if (sum % 10 == 0) {
                sum /= 10;
            } else {
                sum--;
            }
        }
        System.out.println(sum);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args)
	{
	    Scanner scn = new Scanner(System.in);
	    int n = scn.nextInt();
	    int k = scn.nextInt();
	    int s=0;
	    int ktemp=k;
	    while(s<k)
	    {

	    	if(n%10==0)
	    	{
	    		s++;
	    		ktemp=ktemp-1;
	    		n=n/10;
	    		if(ktemp<=0 || s>=k)
	    			break;

	    	}

	    	else if(n%10==ktemp)
	    	{
	    		s=s+ktemp;
	    		n=n-ktemp;
	    		break;
	    	}
	    	else if(n%10>ktemp)
	    	{
	    		n=n-ktemp;
	    		s=s+ktemp;
	    		break;
	    	}
	    	else if(n%10<ktemp)
	    	{
	    		s=s+n%10;
	    		n=n/10;
	    		s++;
	    		ktemp=k-s;
	    		if(ktemp<=0 || s>=k)
	    			break;
	    	}

	    }
	        System.out.println(n);

	}
}

import java.util.*;
public class Q2 {
    public static void main(String[]args){
     Scanner s=new Scanner(System.in);

	int x=0;
	int y=s.nextInt();
	int z=s.nextInt();
	while(x<z){
	    if(y%10==0){
	    y/=10;
	    x++;}
	    else if(y%10!=0){
	    y-=1;
	    x++;}
	}
		System.out.println(y);
	}
}

import java.util.Scanner;

public class WrongSubtraction {

    public static void main(String[] args) {

        Scanner skanneri = new Scanner(System.in);
        int numero = skanneri.nextInt();
        int kertaa = skanneri.nextInt();

        for(int i = 0; i < kertaa; i++)
        {
            if(numero % 10 == 0)
            {
                numero = numero / 10;
            }
            else
            {
                numero = (numero - 1);
            }
        }

        System.out.println(numero);
    }
}

import java.util.Scanner;

public class WrongSubtraction {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int t = 0;
        while (t < k) {
            if (n % 10 == 0) {
                n = n / 10;
            } else {
                n = n - 1;
            }
            t++;
        }
        System.out.println(n);
    }
}

import java.util.Scanner;
import java.lang.Math;
public class janam{
	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		int k = scanner.nextInt();
		if(n>=10){
		    for(int i=0;i<k;i++){
		        long n1 = n %10;
		        if(n1==0){
		        n=n/10;
		        }
		        else{
		        n=n-1;
		        }
		    }
		    System.out.println(n);
		}
        else if(n<10){
            for(int i=0;i<k;i++){
                n=n-1;
          }
          System.out.println(n);
        }
	}
}

import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args)
	{
		// your code goes here
		Scanner sc = new Scanner (System.in);

		  Integer n = sc.nextInt();
		  Integer k =sc.nextInt();

		  while(k>0) {
				if(n%10 == 0) { //last digit 0
				n/=10;
				}
				else {
					--n ;
				}

				k--;
			}
			System.out.print(n);
	}
}

import java.util.Scanner;
public class WrongSubtraction {
  public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int k = in.nextInt();
    while (k-- > 0) {
      if (n%10 == 0) {
        n /= 10;
      } else {
        n--;
      }
    }
    System.out.println(n);
    in.close();
  }
}

import java.util.Scanner;
public class Java {

    public static void main(String[] args) {

         int n, k;

         Scanner ob1 = new Scanner(System.in);

         n = ob1.nextInt();

         k = ob1.nextInt();

         for(int i=1;i<=k;i++)
         {
             if(n%10==0)
             {
                 n=n/10;
          }
             else
             {
                 n=n-1;
             }

         }
         System.out.println(n);

    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        for (int i = 0; i < k; i++) {
            if (n % 10 == 0) {
                n /= 10;
            } else {
                n--;
            }
        }
        System.out.println(n);
    }
}

import java.util.Scanner;

public class Wrong_Subtraction {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int m=sc.nextInt();//Divisible number
		int k=sc.nextInt();//how many times it will be subtracted
		int result=0;
		for(int i=0;i<k;i++)
		{

		if(m%10==0)
		{
			result=m/10;
			m=result;
		}
		else
		{
			result=m-1;
			m=result;
		}
		}
		System.out.println(result);

	}

}

import java.io.*;
import java.util.*;

public class watermelon {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        for (int i = 0; i < k; i++) {
            if (n % 10 == 0) n /= 10;
            else n--;
        }
        System.out.println(n);
    }
}

import java.util.Scanner;
public final class Solution
{
    public static void main(String args[])
    {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        int times = scanner.nextInt();

        for(int i = 0; i < times; i++)
        {
            if(num % 10 != 0)
            {
                num--;
            }
            else
            {
                num = num/10;
            }
        }
        System.out.println(num);
    }
}

import java.io.*;
import java.util.*;

public class Main
{
      public static void main(String[] args)
      {
            Scanner sc = new Scanner(System.in);

            int n = sc.nextInt();
            int k = sc.nextInt();

            for(int i=0;i<k;i++)
            {
                  if(n%10 >= 1)
                  {
                        n--;
                  }
                  else
                  {
                        n = n/10;
                  }
            }

            System.out.println(n);

      }
}

import java.util.*;
public class Main
{
	public static void main(String[] args) {

	     Scanner in = new Scanner(System.in);
	       int n = in.nextInt();
	    int t = in.nextInt();
	     while(t-- >0){

	   if (n  % 10 == 0)
	   {
	       n = n/10;
	   }

		else
		{
		    n--;
		}
	}

	System.out.println(n);  // 131203 11
}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int k = s.nextInt();

        System.out.println(divider(n,k));

    }

 private static boolean checkPositive(int number){
        if(number>0){
            return true;
        }
        else
            return false;
    }
    public static int divider(int n, int k) {
        if (!checkPositive(n)) {
            return 0;
        } else {
            while (k > 0) {
                if (n % 10 == 0) {
                    return divider((int) Math.ceil(n / 10), k - 1);

                } else {
                    return divider(n - 1, k - 1);
                }
            }
            return n;
        }
}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        for (int i = 0; i < k; i++) {
            if (n % 10 == 0) {
                n /= 10;
            } else {
                n--;
            }

        }
        System.out.println(n);
    }
}

import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] m = sc.nextLine().split(" ");
		int k = Integer.parseInt(m[1]);
		int n = Integer.parseInt(m[0]);
		for (int i=0;i< k;i++) {
			if (n % 10 == 0) {
				n/=10;
			}else {
				n -= 1;
			}

		}
		System.out.print(n);

	}
}

import java.util.Scanner;
public class HelloClass {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int k = in.nextInt();
    while (k-- > 0) {
      if (n%10 == 0) {
        n /= 10;
      } else {
        n--;
      }
    }
    System.out.println(n);
    in.close();
  }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int a= input.nextInt();
        int k=input.nextInt();
        while( k>0){
            if(a%10!=0){
                a--;
            }else
                a/=10;
            k--;

        }
        System.out.println(a);
    }
}

import java.util.*;
public class WrongSubtraction {
   static Scanner in = new Scanner(System.in);
  public static  int call(int n, int cnt){
	    if(cnt==0)
	        return n;

	    if(n%10!=0)
	       return call(n-1,cnt-1);

	    else
	       return call(n/10,cnt-1);

	}
	public static void main(String[] args) {
		int n=in.nextInt();
		int k=in.nextInt();

		System.out.println(call(n,k));

	}

}

import java.util.Scanner;

public class WrongSubtraction {

    private static int subtract(int input) {
        if (input >= 10) {
            return input%10 == 0 ? input / 10 : input - 1;
        } else if (input > 1) {
            return input - 1;
        }
        return input;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int k = scanner.nextInt();
        for (int i = 0; i < k; i++) {
            input = subtract(input);
        }
        System.out.println(input);
    }
}

import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);

        int num = in.nextInt();
        int times = in.nextInt();

        while(times > 0){
            if(num % 10 > 0) {num--;}
            else {num /= 10;}

            times--;
        }

        System.out.print(num);
    }
}

import java.util.*;
public class Main
{
    public static final void main(String[] args)
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int k=s.nextInt();
        while(k>0)
        {
            if(n%10==0)
               n=n/10;
            else
               n--;
            k--;
        }
        System.out.println(n);
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner (System.in);

        int n = scan.nextInt();
        int k = scan.nextInt();

        for(int i =0; i < k; i++){

            if (n == 0) {
                break;
            }
            else if (n % 10 == 0) {
                n = n/10;
            }
            else n--;

        }
        System.out.println(n);
    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        long n = in.nextLong();

        long k = in.nextLong();

        for (int i = 0; i < k; i++) {
            if (n % 10 != 0) {
                n--;
            } else {
                n = n/10;
            }
        }

        System.out.print(n);

        in.close();
    }
}

public class diff{

    public static void main(String[] args){

        int n = 512;
        int k = 4;

        while(k != 0){
            if(n % 10 == 0){
                n = n / 10;
            }

            else{
                n = n - 1;
            }

            k--;
        }
        System.out.println(n);
    }
}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        for (int i = 0;i<k;i++) {
            if (n % 10 != 0) n = n -1;
            else {
                n = (int)(n/10) - 1;
            }
        }
        System.out.println(n);
    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 *
 * @author pc
 */
public class Excercices {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();

        System.out.print("n: ");
        int n = sc.nextInt();

        System.out.print("k: ");
        int k = sc.nextInt();

        for(int i = 0; i <k; i++){
            if(n%10==0){
                n=n/10;
            }
            else{
                n--;
            }
        }

        System.out.println(n);

    }

    public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

}

import java.util.Scanner;

public class test{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();int k = sc.nextInt(),temp;
        while(k > 0){
            temp = k > num % 10 ? k - num % 10 : 0;
            if(temp == 0){
                System.out.println(num - k);
                break;
            }else{
                k -= num % 10 + 1;
                num /= 10;
            }
        }
        System.out.println(num);
    }
}

import java.util.Scanner;
import java.lang.Math;
public class janam{
	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		int k = scanner.nextInt();
		while(n>=10){
		    for(int i=0;i<k;i++){
		        long n1 = n %10;
		        if(n1==0){
		        n=n/10;
		        }
		        else{
		        n=n-1;
		        }
		    }
		    System.out.println(n);
		}
        if(n<10){
            System.out.println(n);
        }
	}
}

import java.util.*;

public class Submission {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String nk[] = scanner.nextLine().split(" ");
        scanner.close();

        int n = Integer.parseInt(nk[0]);
        int k = Integer.parseInt(nk[1]);

        int result = n;
        int mod = n % 10;

        for (int i = 0; i < k; i++) {
            mod = result % 10;
            if (mod == 0) {
                result = result / 10;
            } else {
                result = result - mod;
                i += mod - 1;
            }
        }

        System.out.println(result);
    }
}

public class WrongSubtraction{

     public static void main(String []args){
        int n = 1000000000;int i = 9;
        System.out.println("input");
        System.out.println(n + " "+ i);
        int k = getCorrectValue(n, i);
        System.out.println("output");
        System.out.println(k);
     }

     public static int getCorrectValue(int n, int a) {

         while(a>0) {
             if(n%10==0) {
                 n = n/10;
             } else {
                 n = n-1;
             }
             a--;
         }

         return n;
     }
}

public class Here{
    public static void main(String[] args){
        int n = 1000000000, k = 9;

        for (int i = 0; i < k; i++){
            if (n % 10 == 0)
                n /= 10;
            else
                n--;
        }
        System.out.println(n);
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforce;

import java.util.Scanner;

/**
 *
 * @author 123
 */
public class CodeForce {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
//
       int a ;
       short b ;

       a = s.nextInt();
       b = s.nextShort();

        for (int i = 1; i < b; i++) {
            if (a%10 == 0) {
                a = a/10;
            }
            a = a-1;
        }

        System.out.print(a);
//
//        String in, sh, f = null;
//        int counter = 0, b;
//        b = s.nextInt();
//        in = s.next();
//
//        for (int i = 0; i < b - 1; i++) {
//            int c = 0;
//            sh = in.substring(i, i + 2);
//            for (int j = 0; j < b - 1; j++) {
//                if ((sh).equals(in.substring(j, j + 2))) {
//                    c++;
//                }
//                if (c > counter) {
//                    counter = c;
//                    f = sh ;
//                }
//            }
//
//        }
//        System.out.print(f);
//
//         short i , a = s.nextShort();
//         boolean flag = false;
//         for (i = 0; i < a; i++) {
//            byte q = s.nextByte();
//            if (q==1)
//                flag = true;
//        }
//         if (flag)
//             System.out.print("HARD");
//         else
//             System.out.print("EASY");ذ

//        int limak, bob, i = 1;
//        limak = s.nextInt();
//        bob = s.nextInt();
//        for (;; i++) {
//            limak = limak * 3;
//            bob = bob * 2;
//
//            if (limak > bob) {
//                break;
//            }
//        }
//        System.out.print(i);
//        int students = s.nextInt(), hight = s.nextInt(), counter = 0, input;
//        for (int i = 0; i < students; i++) {
//            input = s.nextInt();
//            if (input <= hight) {
//                counter = counter+1;
//            } else {
//                counter = counter+2;
//            }
//        }
//        System.out.println(counter);
//        int n = s.nextInt(), f = s.nextInt(), t = s.nextInt(), max = 0;
//
//        if (n + f + t > max) {
//            max = n + f + t;
//        }
//        if (n * f + t > max) {
//            max = n * f + t;
//        }
//        if (n * (f + t) > max) {
//            max = n * (f + t);
//        }
//        if (n + f * t > max) {
//            max = n + f * t;
//        }
//        if ((n + f) * t > max) {
//            max = (n + f) * t;
//        }
//        if (n * f * t > max) {
//            max = n * f * t;
//        }
//
//        System.out.println(max);
    }

}

import java.io.BufferedReader;
import java.io.*;
import java.util.*;
public class Problem {
	public static void main(String[] args)throws IOException
	{

		Scanner scan = new Scanner(System.in);
		int n =  scan.nextInt() , k = scan.nextInt();
		for (int x= 1; x<k; x++)
		{
			if(n%10==0)
			{
				n = (n/10);
			}
			else
			{
				n = n-1;
			}

		}
		System.out.println(n);

    }

}

import java.util.Scanner;

public class Main {

    public static void main(String args[])
    {
        Scanner ip = new Scanner(System.in);
        int a = ip.nextInt();
        int b = ip.nextInt();

        for (int i = 0 ; i < b ; i++){
            if (a % 10 == 0) {
                a /= 10;

            }
            while(a % 10 != 0 && a > 9){
                a--;
                i++;
            }

        }
        System.out.println(a);
    }
}

import java.util.Scanner;

public class test{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();int k = sc.nextInt(),temp;
        while(k > 0){
            temp = k > num % 10 ? k - num % 10 : 0;
            if(temp > 0){
                System.out.println(num - k);
                break;
            }else{
                k -= num % 10;
                num /= 10;
            }
        }
        System.out.println(num);
    }
}

import java.util.Scanner;
import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here

        Scanner sc = new Scanner(System.in);
        long n;
        int k,i;
        n = sc.nextInt();
        k = sc.nextInt();

       for(i = 1; i <= k; i++) {
           if (n % 10 == 0)
               n /= 10;
            else
               n--;
       }
        System.out.println("n = " +n);
    }
}

import java.util.*;
public class subtraction{
  public static void main(String args[]){
      int n;
      int k;
      Scanner scan=new Scanner(System.in);
      n=scan.nextInt();
      k=scan.nextInt();
      int p=n;
      int r=p%10;
      int count=0;

      if(r!=0){

      if(r-k>=0){
          System.out.print(n-k);
      }
      else{
          for(;r>0;r--){
              n--;
              count++;
          }

      for(;k-count>=0;count++){
          n=n/10;
      }
      System.out.print(n);
      }
      }
      else{
          for(;count<k;count++){
              n=n/10;
          }
          System.out.print(n);
      }
  }
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
      static  Scanner scanner = new Scanner(System.in);
      static  ArrayList<Integer> arrayList = new ArrayList<>();
    public static void main(String[] args) {
int a = scanner.nextInt();
int b = scanner.nextInt();
for (int i =0;i<b;i++){
    if(a%10 == 0){
        a/=10;
    }
    else {
        a--;
    }
}
        System.out.println(b);
    }
}

import java.io.BufferedReader;
import java.io.*;
import java.util.*;
public class Problem {
	public static void main(String[] args)throws IOException
	{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		Scanner scan = new Scanner(System.in);
		int n =  scan.nextInt() , k = scan.nextInt();
		for (int x= 1; x<k; x++)
		{
			if(n%10==0)
			{
				n = (n/10) ;
			}
			else
			{
				n = n-1;
			}

		}System.out.println(n);

    }

}

import java.io.*;
import java.util.*;

public class Vaibhav
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        while(k>0)
        {
            int sub = n % 10;
            if(sub==0)
            {
                k--;
                n=n/10;
            }
            else
            {
                if(k>sub)
                    k = k- sub ;
                else
                {
                    k=0;
                    sub = k ;
                }
                n=n-sub;
            }

        }
        System.out.println(n);

    }
}

import java.lang.Long;
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
         Scanner x = new Scanner (System.in);
        Long [] y = new Long [2];
        for(int i=0;i<2;i++){
            long z = x.nextLong();
            y[i]=z;
        }
        String z = String.valueOf(y[0]);
        String w = z.substring(z.length()-1);
       long q = Long.parseLong(w);

       for(long i = y[1];i>0;i--){
            if(q>0){q--;}
            else{
                y[0]/=10L;
                 z = String.valueOf(y[0]);
                 w = z.substring(z.length()-1);
                 q = Long.parseLong(w);
            }

       }
        String c = String.valueOf(q);

       System.out.println(z.replace(w,c));
    }
}

import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        for(int i=0;i<k;i++)
        {
            if(i%10!=0&&n<0)
            n--;
            else if(i%10==0&&n<0)
            n=n/10;
            else
            {}
        }
        System.out.println(n);
    }
}

import java.lang.*;
import java.util.Scanner;
public class WrongSubtraction {

    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       String n;
        n=sc.nextLine();
        String a1[]=n.split(" ");
        if(a1.length==2){
        int a2[]=new int[2];
        for(int i=0;i<a1.length;i++){
            a2[i]=Integer.parseInt(a1[i]);
        }
        int rem=0;
        int m=a2[0];
        int m1=a2[1];
                        if(m%10==0){
                        do{
                            rem=m%10;
                            if(rem==0){
                                m=m/10;
                                m1--;
                            }
                            if(rem!=0){
                                break;
                            }
                            if(m1==0){
                                System.out.println(m);
                                break;
                            }
                        }while(m1!=0);

                        }
                        else{

                m=a2[0];
                m1=a2[1];
                rem=0;
                int rem1=0;

                               for(int i=0;i<=100000;i++){
                               while(m%10!=0){
                                   m=m-1;
                                   m1--;
                                   if(m1==0){
                                       System.out.println(m);
                                       break;
                                   }
                               }
                               if(m%10==0){
                                   m=m/10;
                                   m1--;
                                   if(m1==0){
                                     System.out.println(m);
                                     break;
                                   }
                               }
                               }
                        }

        }
        }
}

import java.util.Scanner;

public class Task_977A {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()) {
            String line = scanner.next();
            String[] parts = line.split(" ");
            if (parts.length != 2) {
                continue;
            }
            int number1 = Integer.parseInt(parts[0]);
            int number2 = Integer.parseInt(parts[1]);

            for (int i = 0; i < number2; i++) {
                if (number1 % 10 == 0) {
                    number1 = number1 / 10;
                } else {
                    number1--;
                }
            }
            System.out.println(number1);
        }
    }
}

import java.util.Scanner;

public class WrongSubtraction {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//Problem https://codeforces.com/problemset/problem/977/A
		int n,k;
		Scanner scan = new Scanner(System.in);
		//System.out.println("enter n");
		n = scan.nextInt();
		//System.out.println("enter k");
		k = scan.nextInt();
		scan.close();
		System.out.println(n);
		//Subtract one k times.
		for(int i =0;i<k;i++) {
			//If the last digit of the number is zero, divide by 10
		if(n%10 == 0) {
			n = n/10;
		}
		//If the last digit of the number is non-zero, decreases the number by one.
		else {
			n--;
		}
		System.out.println(n);
		}
	}

}

import java.util.Scanner;

public class WrongSubtraction {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//Problem https://codeforces.com/problemset/problem/977/A
		int n=0,k=0;
//		Scanner scan = new Scanner(System.in);
//		System.out.println("enter n");
//		n = scan.nextInt();
//		System.out.println("enter k");
//		k = scan.nextInt();
//		scan.close();
		System.out.println(n);
		//Subtract one k times.
		for(int i =0;i<k;i++) {
			//If the last digit of the number is zero, divide by 10
		if(n%10 == 0) {
			n = n/10;
		}
		//If the last digit of the number is non-zero, decreases the number by one.
		else {
			n--;
		}

		}
		System.out.println(n);
	}

}

import java.util.Scanner;

public class Testing
{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int sub = in.nextInt();
        for (int i = 0; i < sub; i++) {
            num -= 1;
            if (num % 10 == 0) {
                num /=10;
                i++;
            }
        }
        System.out.println(num);
    }
}

import java.io.*;
import java.util.*;
import java.lang.*;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong();
        int k=sc.nextInt();
        int count=1;
        while(count<k&&n>0){
            while(n%10==0){
                n=n/10;
            }
            if(n-1>0){
                n=n-1;
                count++;
            }
            else break;
        }
        System.out.println(n);
    }
}

import java.util.*;
public class Solution{
    public static void main(String[] args){
        Scanner sc  = new Scanner(System.in);
        int a = sc.nextInt();
        int k = sc.nextInt();
        while(k-->0){
            if((a%2) != 0){
                a-=1;
            }else{
                a/=10;
            }
        }
        System.out.println(a);
    }
}

public class NewClass {

	public static void main(String[] args) {

		System.out.println(WrongSubtraction(512 , 4));
		System.out.println(WrongSubtraction(1000000000 , 9));
	}

	public static int WrongSubtraction(int number, int index) {

		for (int i = 0; i < index; i++) {
			if ((number % 10) == 0)
				number /= 10;
			else
				number -= 1;
		}
		return number;
	}

}

import java.util.*;
public class WrongSubtraction {
   static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int n=in.nextInt();
		int k=in.nextInt();

		for(int i=1;i<k;i++)
		{

			while(n%10==0&&n!=10)
			{
				n=n/10;

			}
			if(n==10)
			{ i--;
				n--;
			}
			else if(n%10!=0)
			n--;

			System.out.println(n);

		}
		System.out.println(n);

	}

}

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
                Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        for (int i = 0; i < k; i++) {
            if (n / 10 == 0) {
                n = n / 10;
            }
            else{
                n = n - 1;
            }
        }
        System.out.println( n);

    }
}

import java.util.Scanner;

public class WrongSubtraction {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//Problem https://codeforces.com/problemset/problem/977/A
		int n,k;
		Scanner scan = new Scanner(System.in);
		//System.out.println("enter n");
		n = scan.nextInt();
		//System.out.println("enter k");
		k = scan.nextInt();
		scan.close();
		System.out.println(n);
		//Subtract one k times.
		for(int i =0;i<k;i++) {
			//If the last digit of the number is zero, divide by 10
		if(n%10 == 0) {
			n = n/10;
		}
		//If the last digit of the number is non-zero, decreases the number by one.
		else {
			n--;
		}

		}
		System.out.println(n);
	}

}

import java.util.Scanner;

public final class Tayna{

    public static void main(String[] args){
        Scanner key = new Scanner(System.in);

        wrongSub(key.nextInt(), key.nextInt());

    }

    public static void wrongSub(int a, int b){

        int ret = a;

        for(int i = 0; i < b; i++){

            b--;
            if(ret%10 == 0)
                ret = ret/10;

            else
                ret--;

        }

        System.out.println(ret);

    }

}

public class NewClass {

	public static void main(String[] args) {

	    int x = 512;
	    int y =4;

		System.out.println(WrongSubtraction(x, y));
	}

	public static int WrongSubtraction(int number, int index) {

		for (int i = 0; i < index; i++) {
			if ((number % 10) == 0)
				number /= 10;
			else
				number -= 1;
		}
		return number;
	}

}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int k = sc.nextInt();
        int n = sc.nextInt();

        while (k-- > 0) {
            if (n % 10 != 0)
                n--;
            else
                n /= 10;
        }
        System.out.println(n);

    }

}

import java.util.*;
public class Solution{
    public static void main(String[] args){
        Scanner sc  = new Scanner(System.in);
        int a = sc.nextInt();
        int k = sc.nextInt();
        while(k-->0){
            if((a/10) == 1){
                a-=1;
            }else{
                a/=10;
            }
        }
        System.out.println(a);
    }
}

import java.util.*;
public class WrongSubtraction {
   static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int n=in.nextInt();
		int k=in.nextInt();

		for(int i=1;i<k;i++)
		{

			while(n%10==0&&n!=10)
			{
				n=n/10;

			}
			if(n%10!=0)
			n--;
			if(n==10)
				n--;

		}
		System.out.println(n);

	}

}

import java.util.Scanner;
public class Wrong_Subtraction {
    public static void main (String[]args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        for (int i = 1; i<= k ; i++){
            if(n % 10 == 0)
                n = n/10;
            else
                n = n -1;
        }
    }
}

import java.io.*;
import java.util.*;

public class GFG
{
	public static void main (String[] args) {
		int one,two;
		Scanner sc = new Scanner(System.in);
		one = sc.nextInt();
		two = sc.nextInt();

		for(int i=0;i<=two;i++)
		{
		    if(one > 0 && one%10 != 0)
		    {
		        one = one - 1;
		    }
		    else
		    {
	             one = one/10;
		    }
		}
		System.out.println(one);
	}
}

import java.util.*;
public class Solution{
    public static void main(String[] args){
        Scanner sc  = new Scanner(System.in);
        int a = sc.nextInt();
        int k = sc.nextInt();
        while(k-->0){
            if((a&1) == 1){
                a-=1;
            }else{
                a/=10;
            }
        }
        System.out.println(a);
    }
}

import java.util.Scanner;

public class WrongSubtraction {

	long n;
	int k;

	public WrongSubtraction(long n,int k) {
		this.n=n;
		this.k=k;
	}

	public void determine() {
		if(k>=1 && k<=50 && n>=2 && n<=1000000000) {
			System.out.println(getInitial());
		}else {
			System.out.println();
		}
	}

	public long getInitial(){
		long ge;
		while(true) {
			if(n<10) {
				break;
			}
			while(true) {
				ge=n%10;
				k--;
				if(ge==0) {
					n/=10;
					break;
				}
				n--;
				if(k==0) {
					return n;
				}
			}
		}
		return n;
	}

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		long n=input.nextLong();
		int k=input.nextInt();
		WrongSubtraction ws=new WrongSubtraction(n,k);
		ws.determine();
	}
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
      static  Scanner scanner = new Scanner(System.in);
      static  ArrayList<Integer> arrayList = new ArrayList<>();
    public static void main(String[] args) {
int a = scanner.nextInt();
int b = scanner.nextInt();
for (int i =0;i<b;i++){
    if(b%10 == 0){
        b/=10;
    }
    else {
        b--;
    }
}
    }
}

public class WrongSubtraction {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

import java.io.*;
import java.util.*;

public class WrongSubtraction {
	public static void main(String args[]) throws IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

	WrongSubtraction obj_ref = new WrongSubtraction();

	StringTokenizer st = new StringTokenizer(br.readLine());
	int n = Integer.parseInt(st.nextToken());
	int k = Integer.parseInt(st.nextToken());

	int result = obj_ref.solve(n, k);
	bw.write(result+"");
	bw.flush();
	}

public int solve(int n, int k) {
	for(int i=0;i<k;i++) {
		if((n & 1)==0)
			n /= 10;
		else
			n -= 1;
		}
		return n;
	}
}

import java.util.Scanner;

public class Testing
{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int sub = in.nextInt();
        for (int i = 0; i < sub; i++) {
            num -= 1;
            if (num % 10 == 0) {
                num /=10;
                i++;
            }
        }
        System.out.println(num);
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String args[])
    {
        Scanner ip = new Scanner(System.in);
        int a = ip.nextInt();
        int b = ip.nextInt();

        for (int i = 0 ; i < b ; i++){
            if (a % 10 == 0) {
                a /= 10;

            }
            while(a % 10 != 0 && a > 9){
                a--;
                i++;
            }

        }
        System.out.println(a);
    }
}

import java.util.*;
/**
 *
 * @author pc
 */
public class Excercices {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int n;
        int k;
        Scanner entrada = new Scanner(System.in);

        System.out.print("n: ");

        n = entrada.nextInt();
        System.out.print("k: ");
        k = entrada.nextInt();

        for(int i = 0; i <k; i++){
            if(n%10==0){
                n=n/10;
            }
            else{
                n--;
            }
        }

        System.out.println(n);

    }

}

public class Problem {
	public static int subtractions(int n, int k) {
		for(int i = 0; i < k; i++) {
			if(n%10 != 0) {
				n -= 1;
			}
			else {
				n /= 10;
			}
		}
		return n;
	}

	public static void main(String[] args) {
		System.out.println(subtractions(512, 4));
		System.out.println(subtractions(1000000000, 9));
	}
}

import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException{
        Scanner in = new Scanner(System.in);

        StringTokenizer st = new StringTokenizer(in.nextLine());

        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());

        for (int i = 0; i < k; i++){
            if(n%10 == 0){
                n /= 10;
            }else{
                n--;
            }
        }

    }
}

import java.util.Scanner;

public class WrongSubtraction {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//Problem https://codeforces.com/problemset/problem/977/A
		int n,k;
		Scanner scan = new Scanner(System.in);
		System.out.println("enter n");
		n = scan.nextInt();
		System.out.println("enter k");
		k = scan.nextInt();
		scan.close();
		System.out.println(n);
		//Subtract one k times.
		for(int i =0;i<k;i++) {
			//If the last digit of the number is zero, divide by 10
		if(n%10 == 0) {
			n = n/10;
		}
		//If the last digit of the number is non-zero, decreases the number by one.
		else {
			n--;
		}
		System.out.println(n);
		}
	}

}

import java.util.Scanner;

public class IncorrectSub {

    public static void main(String[] args) {
        System.out.println(calculation(512, 4));
    }

    public static int calculation(int k, int n) {

        for(int i = 0; i < n; i++)
            k = k % 10 == 0 ? k/=10 : --k;

        return k;
    }
}

import java.util.*;

public class wrongSubtraction
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int n = scanner.nextInt();
        for(int i = 0; i < k; i++)
        {
            if(n % 10 == 0)
                n /= 10;
            else
                n--;
        }
        System.out.println(n);
    }
}

import java.util.ArrayList;
import java.util.Scanner;

public class WrongSubtraction {

    public static void main(String[] args) {

        Scanner skanneri = new Scanner(System.in);
        ArrayList<Character>numeroLista = new ArrayList<>();
        int numero = skanneri.nextInt();
        int kertaa = skanneri.nextInt();
        String taulukoksi = Integer.toString(numero);
        char[] numeroArray = taulukoksi.toCharArray();
        for(int k=0; k<numeroArray.length; k++)
        {
            numeroLista.add(numeroArray[k]);
        }

        for(int i = 0; i < kertaa; i++)
        {
            if(numero % 10 == 0)
            {
                numeroLista.remove(numeroLista.get((numeroLista.size() - 1)));
                taulukoksi = numeroLista.toString().replaceAll("\\[|\\]|, ","");;
                numero = Integer.parseInt(taulukoksi);
            }
            else
            {
                numero = (numero - 1);
            }
        }

        System.out.println(numero);
    }
}

import java.util.Scanner;

public class WrongSubtraction {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int t = 1;
        while (t < k && n > k) {
            if (n % 10 == 0) {
                n = n / 10;
            } else {
                n = n - 1;
                t++;
            }
        }
        System.out.println(n);
    }
}

import java.util.*;
public class Solution{
    public static void main(String[] args){
        Scanner sc  = new Scanner(System.in);
        int a = sc.nextInt();
        int k = sc.nextInt();
        while(k-->0){
            if((a%10) == 1){
                a-=1;
            }else{
                a/=10;
            }
        }
        System.out.println(a);
    }
}

import java.util.Scanner;
import java.lang.Math;
public class janam{
	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		int k = scanner.nextInt();
		while(n>=10){
		    for(int i=0;i<k;i++){
		        long n1 = n %10;
		        if(n1==0){
		        n=n/10;
		        }
		        else{
		        n=n-1;
		        }
		    }
		    System.out.println(n);
		}
        if(n<10){
            System.out.println(n);
        }
	}
}

import java.util.Scanner;

public class Test1 {

    public static void main(String[] args) {

        Scanner BobScanner = new Scanner(System.in);

        int n;
        int k;

        System.out.println(" Please input what number you want to subtract ");
        n = BobScanner.nextInt();

        System.out.println(" Please input the number of times you want to subtract n ");
        k = BobScanner.nextInt();

        for (int i = 0; i < k; i++) {

            if (n % 10 == 0) {
                n = n / 10;
            } else {
                n--;
            }
        }
        System.out.println(n);
    }
}

import java.util.Scanner;
import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here

        Scanner sc = new Scanner(System.in);
        long n;
        int k,i;
        n = sc.nextInt();
        k = sc.nextInt();

        if(k!=0)
       for(i = 0; i < k; i++) {
           if (n % 10 == 0)
               n /= 10;
            else
               n--;
       }else
        System.out.println("" +n);
    }
}

import java.io.*;
import java.util.*;

public class Vaibhav
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        while(k>0)
        {
            int sub = n % 10;
            if(sub==0)
            {
                k--;
                n=n/10;
            }
            else
            {
                if(k>sub)
                    k = k- sub ;
                else
                {
                    k=0;
                    sub = sub - k ;
                }
                n=n-sub;
            }

        }
        System.out.println(n);

    }
}

import java.io.*;
import java.util.*;

public class Vaibhav
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        while(k>0)
        {
            int sub = n % 10;
            k = k- sub ;
            n=n-sub;
            n=n/10;
            k--;
        }
        System.out.println(n);

    }
}

public class Tanya {

    public static void main(String[] args) {

	int n = 1000000000 ;
;
	int k = 9;

	for(int i = 0 ; i < k; i++) {

	    if( n % 10 == 0) {

		n = n/10;

	    }else {

		n = n - 1;

	    }
	}

	System.out.println(n +" "+ k);

    }

}

public class Main {

    public static int n1;
    public static int k1;

    public static void main(int[] args) {
        n1 = args[0];
        k1 = args[1];
    }
    public static void main(String[] args) {

        int n = n1;
        int k = k1;

        for(int i =0; i < k; i++){

            if (n == 0) {
                break;
            }
            else if (n % 10 == 0) {
                n = n/10;
            }
            else n--;

        }
    }

}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int k = sc.nextInt();

        while(k > 0) {
            if(n%10 != 0) {
                int temp = (n%10);
                k -= temp;
                n -= temp;
            } else {
                k -= 1;
                n /= 10;
            }
        }

        System.out.println(n);
	}
}

public class a977 {

    static void subtraction() {
        int n = (int) (Math.random() * 999999998 + 2);
        int k = (int) (Math.random() * 50 + 1);
        for (int i = k; i > 0; i--) {
            if (n % 10 == 0) {
                n = n / 10;
                System.out.println(n);
            } else {
                n = n - 1;
                System.out.println(n);
            }
        }
    }

    public static void main(String[] args) {
        subtraction();
    }
}

import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author bd340
 */
public class NewClass
{

    public static void main(String[] args) {
       // NewClass ne=new NewClass();int
         Scanner sc=new Scanner(System.in);
         int n=sc.nextInt();
         int m=sc.nextInt();
         int r=0;
 //        for(int i=0;i<m;i++)
    int i=0;
        while( i<m)
        {
            if(n%10!=0)
            {
            n=n-1;

            System.out.println("lo:"+n);
            }
            else
            {
                n=n/10;
            }
            i++;
        }

            //n=n/10;

        System.out.println(n);
}
         // System.out.println(r);
}

import java.io.BufferedReader;
import java.io.*;
import java.util.*;
public class Problem {
	public static void main(String[] args)throws IOException
	{
		Scanner scan = new Scanner(System.in);
		int n =  scan.nextInt() , k = scan.nextInt();
		for (int b = 1; b<k; b++)
		{
			if(n%10==0)
			{
				n = (n/10);
			}
			else
			{
				n = n-1;
			}
		}
		System.out.println(n);
	   }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args)
	{
	    Scanner scn = new Scanner(System.in);
	    int n = scn.nextInt();
	    int k = scn.nextInt();
	    int s=0;
	    int ktemp=k;
	    while(s<k)
	    {
	    	if(n%10==0 || n%10==ktemp)
	    	{
	    		s=s+ktemp;
	    		ktemp=ktemp-n%10;
	    		n=n/10;
	    	}
	    	if(n%10>ktemp)
	    	{
	    		n=n-ktemp;
	    		s=s+ktemp;
	    		break;
	    	}
	    	if(n%10<ktemp)
	    	{
	    		s=s+n%10;
	    		n=n/10;
	    		s++;
	    		ktemp=ktemp-s;

	    	}

	    }
	        System.out.println(n);

	}
}

import java.util.*;

public class ScannerClassExample1 {

public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k =  sc.nextInt();

while(k>0) {
	if(n%10==0) {
                 n = n/10;
             } else {
                 n = n-1;
}
k--;

}
}

}

public class Tanya {

  public static void main(String[] args) {
    try {
      System.out.println(alg(Integer.parseInt(args[0]), Integer.parseInt(args[1])));
    }
    catch(ArrayIndexOutOfBoundsException inputException) {
      System.out.print("fish");
    }
  }

  public static int alg(int n, int k) {
    for(int a = 0; a < k; a++) {
      if(n % 10 != 0) {
        n -= 1;
      }
      else {
        n /= 10;
      }
    }
    return n;
  }

}

import java.util.Scanner;

public class Tanya {
    public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
        int n = scr.nextInt();
        int k = scr.nextInt();
       //Scanner sum = new Scanner(System.in);
       //int k = sum.nextInt();
        int i = 0;
        while (i < k){

            if(n % 10 == 0){
                n = n / 10;

            }
            else {
                n  = n - k;
            }
            i++;
        }
        System.out.print(n);
    }
}

import java.util.*;
import java.lang.*;

// "static void main" must be defined in a public class.
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		while(t-- > 0 && n > 0) {
			while(Math.abs(n) % 10 == 0) {
				n /=10;
			}
			n--;
		}

		System.out.println(n);
		sc.close();
    }
}

import java.util.Scanner;

public class WrongSubtraction {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		System.out.print("Enter the number :   Enter the number of times you want to subtract :");

		int n = sc.nextInt();
		int temp = n;

		int k = sc.nextInt();

				for(int i =1; i<=k; i++) {

					int lastDigit = temp%10;

					if(lastDigit >0) {
						temp -= 1;
					}

					else {
						temp /= 10;
					}
				}
					System.out.println("The number after division is "+temp);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ejercicio {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String l1[]=br.readLine().split(" ");
        String a= l1[0];
        int aux=0;
        int b= Integer.parseInt(l1[1]);
        int cont=0;
        while(cont<b) {
        	 aux= Integer.parseInt(a);
			if(a.lastIndexOf("0")!=-1) {
				a=""+(aux/10);
			}else if(a.lastIndexOf("0")==-1){
				a=""+(aux-1);
				cont++;
			}
			cont++;
		}
        System.out.println(a);

    }

}

public class Here{
    public static void main(String[] args){
        int n = 1000000000, k = 9;

        for (int i = 0; i < k; i++){
            if (n % 10 == 0)
                n /= 10;
            else
                n--;
        }
        System.out.println(n);
    }
}

import java.util.Scanner;

public class Problem977A {

    public static void main(String[] args) {
        Scanner entrada = new Scanner(System.in);
        double tam = Math.pow(10, 9);
        long n = entrada.nextLong();
        long k = entrada.nextLong();
        if ((n>=2 || n<=tam) && (k>=1 && k<=50 )) {
            String x = Long.toString(n);
            String aux = "";
            if (x.endsWith("0")) {
                for (int i = 0; i < k; i++) {
                    n = n / 10;
                }
                System.out.println(n);
            } else {

                for (int i = 0; i < k; i++) {
                    x = Long.toString(n);
                    System.out.println("x = " + x);
                    if (x.endsWith("0")) {
                        for (int j = 0; j < x.length() - 1; j++) {
                            aux += x.charAt(j);
                            n = Integer.parseInt(aux);
                        }
                        aux = "";
                    } else {
                        n--;
                    }
                }
                System.out.println(n);
            }
        }

    }
}

import java.util.Scanner;

public class LuckyNumberCC {
    //codeforce
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int number = sc.nextInt();
        int k = sc.nextInt();
        for(int i=0;i<k;i++){
            int lastDigit = number%10;
            if(lastDigit == 0){
                number--;
            }
            else{
                number = number/10;
            }
        }
        System.out.println(number);
    }

}

import java.util.Scanner;
import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here

        Scanner sc = new Scanner(System.in);
        long n;
        int k,i;
        n = sc.nextInt();
        k = sc.nextInt();

        if(k != 0)
       for(i = 0; i < k; i++) {
           if(n==0)
               break;
           if (n % 10 == 0)
               n /= 10;
            else
               n--;
       }else
        System.out.println("" +n);
    }
}

import java.util.*;
public class WrongSubtraction {
   static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int n=in.nextInt();
		int k=in.nextInt();

		for(int i=1;i<k;i++)
		{

			while(n%10==0&&n!=10)
			{
				n=n/10;

			}
			if(n%10!=0)
			n--;
			if(n==10)
				n--;

		}
		System.out.println(n);

	}

}

import java.util.Scanner;

public final class Tayna{

    public static void main(String[] args){
        Scanner key = new Scanner(System.in);

        wrongSub(key.nextInt(), key.nextInt());

    }

    public static void wrongSub(int a, int b){

        int ret = a;

        for(int i = 0; i < b; i++){

            b--;
            if(ret%10 == 0)
                ret = ret/10;

            else
                ret--;

        }

        System.out.println(ret);

    }

}

import java.util.Scanner;

public class WrongSubtraction {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int t = 1;
        while (t < k && n > (k + 1)) {
            if (n % 10 == 0) {
                n = n / 10;
            } else {
                n = n - 1;
                t++;
            }
        }
        System.out.println(n);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */

public class Main
{

    static PrintWriter out;

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out);
		}
		String next(){
			while(st==null || !st.hasMoreElements()){
				try{
					st= new StringTokenizer(br.readLine());
				}
				catch (IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

// SHIVAM GUPTA :

// ASCII = 48 + i ;

// SHIVAM GUPTA :

public static int  min(int a ,int b , int c, int d)
{

       int[] arr = new int[4] ;
       arr[0] = a;
       arr[1] = b ;
       arr[2] = c;
       arr[3] = d;
       Arrays.sort(arr) ;

       return arr[0];

}

public static int  max(int a ,int b , int c, int d)
{

       int[] arr = new int[4] ;
       arr[0] = a;
       arr[1] = b ;
       arr[2] = c;
       arr[3] = d;
       Arrays.sort(arr) ;

       return arr[3];

}

static int sieve =  1000000 ;

static boolean[] prime =  new boolean[sieve + 1] ;

public static void sieveOfEratosthenes()
    {
        // FALSE == prime

        // TRUE ==  COMPOSITE

        // FALSE== 1

        for(int i=0;i< sieve + 1;i++)
            prime[i] = false;

        for(int p = 2; p*p <= sieve; p++)
        {

            if(prime[p] == false)
            {

                for(int i = p*p; i <= sieve; i += p)
                    prime[i] = true;
            }
        }

    }

public static String reverse(String input)
{
    String op = "" ;

    for(int i = 0; i < input.length() ; i++ )
    {
        op = input.charAt(i)+  op ;
    }

return op ;
}

public static int[] sortI(int[] arr)
{
      Arrays.sort(arr) ;
      return arr ;
}

public static int[] sortD(int[] arr)
{
      Arrays.sort(arr) ;

      int i =0 ; int j = arr.length -1  ;

      while( i < j)
      {
            int temp = arr[i] ;
            arr[i] =arr[j] ;
            arr[j] = temp ;
            i++ ; j-- ;
      }

      return arr ;
}

public static boolean sameParity(long a  ,long b )
{

      if(a%2 == b %2)
      {
            return true  ;
      }
      else{
            return false  ;
      }
}

public static boolean isPossibleTriangle(int a  ,int b , int c)
{
      if( a + b > c && c+b > a && a +c > b)
      {
            return true  ;
      }

      return false  ;

}

public static int gcd(int a, int b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

public static int lcm(int a, int b ,int c , int d )
{

int temp = lcm(a,b , c) ;

 int ans = lcm(temp ,d ) ;

return ans  ;

}

public static int lcm(int a, int b ,int c )
{

int temp = lcm(a,b) ;

int ans =  lcm(temp ,c) ;

return ans  ;

}

public static int lcm(int a , int b )
{

int gc = gcd(a,b);

return (a*b)/gc ;

}

static boolean isPrime(int n)
{
      if(n==1)
      {
            return false  ;
      }

      boolean ans =  true  ;

      for(int i = 2; i*i <= n ;i++)
      {
            if(n% i ==0)
            {
                  ans = false  ;break ;
            }
      }

      return ans  ;

}

public static ArrayList<Integer> allFactors(int n)
{
      ArrayList<Integer> list = new ArrayList<>() ;

    for(int i = 1; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}

public static boolean isPowerOfTwo(int n)
{
    if(n==0)
    return false;

if(((n ) & (n-1)) == 0 ) return true ;
else return false  ;

}

    public static int countDigit(long n)
    {
        return (int)Math.floor(Math.log10(n) + 1);
    }

   static final int MAXN = 100001;

    static int spf[] = new int[MAXN];

    static void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)

            spf[i] = i;

        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {

            if (spf[i] == i)
            {

                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

// The above code works well for n upto the order of 10^7.
// Beyond this we will face memory issues.

// Time Complexity: The precomputation for smallest prime factor is done in O(n log log n)
// using sieve.
// Where as in the calculation step we are dividing the number every time by
// the smallest prime number till it becomes 1.
// So, let’s consider a worst case in which every time the SPF is 2 .
// Therefore will have log n division steps.

// Hence, We can say that our Time Complexity will be O(log n) in worst case.

    static Vector<Integer> getFactorization(int x)
    {
        Vector<Integer> ret = new Vector<>();
        while (x != 1)
        {
            ret.add(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }

   public static void help(int[] arr ,int si , int ei)
   {
         if(arr[si] == arr[si+1] || arr[ei] == arr[ei-1] )
         {
               return ;
         }

         if(arr[si] < arr[si+1] && arr[ei-1] < arr[ei] )
         {
               arr[si+1] = -1*arr[si+1] ;
               return ;
         }

         else if(arr[si] > arr[si+1] && arr[ei-1] > arr[ei])
         {
              arr[si+1] = -1*arr[si+1] ;
               return ;
         }
         else{
               return ;
         }

   }

public static void main (String[] args) throws java.lang.Exception
{
  FastReader scn = new FastReader() ;
int n = scn.nextInt() ;
int k = scn.nextInt() ;

if(n % 10 == 0)n =  n/10 ;
else n = n-1  ;

out.println(n) ;

out.flush() ;

}

}

 class Pair implements Comparable<Pair>
{
  int val ;

  String str  ;

Pair(int val , String str)
{
      this.val = val ;
      this.str = str  ;
}

  public int compareTo(Pair o)
    {
        return this.val - o.val;
    }

}

public class Tanya {

    public static void main(String[] args) {

	int n = 1000000000 ;
	int k = 9;

	for(int i = 0 ; i < k; i++) {

	    if( n % 10 == 0) {
		n = n/10;
	    } else {
		n = n - 1;
	    }
	}

	System.out.println(n);

    }

}

import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        long n = scan.nextLong();
        long k = scan.nextLong();

        long num = n;
        while(k>0 && num != 1){

            long rem = num%10;
            if(rem != 0){
                num = num-1;
                k--;
            }
            else{
                num = num/10;
            }
        }

        System.out.print(num);
    }
}

import java.util.Scanner;

public final class Tayna{

    public static void main(String[] args){
        Scanner key = new Scanner(System.in);

        wrongSub(key.nextInt(), key.nextInt());

    }

    public static void wrongSub(int a, int b){

        int ret = a;

        for(int i = 0; i < b; i++){

            b--;
            if(ret%10 == 0)
                ret /= 10;

            else
                ret--;

        }

        System.out.println(ret);

    }

}

import java.io.BufferedReader;
import java.io.*;
import java.util.*;
public class Problem {
	public static void main(String[] args)throws IOException
	{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		Scanner scan = new Scanner(System.in);
		int n =  scan.nextInt() , k = scan.nextInt();
		for (int x= 1; x<=k; x++)
		{
			if(n%10==0)
			{
				n = (n/10)-1;
			}
			else
			{
				n = n-1;
			}

		}System.out.println(n);

    }

}

import java.util.Scanner;
public class Wrong_Subtraction {
    public static void main (String[]args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        for (int i = 1; i<= k ; i++){
            if(n % 10 == 0)
                n = n/10;
            else
                n = n -1;
        }
    }
}

import java.util.Scanner;
import java.lang.Math;
public class janam{
	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		int k = scanner.nextInt();
		while(n>=10){
		    for(int i=0;i<k;i++){
		        long n1 = n %10;
		        if(n1==0){
		        n=n/10;
		        }
		        else{
		        n=n-1;
		        }
		    }
		    System.out.println(n);
		}
        if(n<10){
            System.out.println(n);
        }
	}
}

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      while(n % 10 == 0) {
          n = n / 10;
      }
      if(n < k) {
          System.out.println(n);
      } else {
        int i = 0;
        while(i < k - 1) {
            while(n % 10 == 0) {
                n = n / 10;
            }
            n = n - 1;
            i++;
        } System.out.println(n);
      }

    }
}

import java.util.*;

public class Submission {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String nk[] = scanner.nextLine().split(" ");
        scanner.close();

        int n = Integer.parseInt(nk[0]);
        int k = Integer.parseInt(nk[1]);

        int result = 0;
        int mod = n % 10;

        for (int i = 0; i < k; i++) {
            if (mod == 0) {
                result = result / 10;
            } else {
                result = result - mod;
            }
        }

        System.out.println(result);
    }
}

import java.util.*;

public class A {

public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k =  sc.nextInt();

while(k>0) {
	if(n%10==0) {
                 n = n/10;
             } else {
                 n = n-1;
}
k--;

}
}
}

import java.util.Scanner;

public class WrongSubtraction {

	long n;
	int k;

	public WrongSubtraction(long n,int k) {
		this.n=n;
		this.k=k;
	}

	public void determine() {
		if(k>=1 && k<=50 && n>=2 && n<=1000000000) {
			System.out.println(getInitial());
		}else {
			System.out.println();
		}
	}

	public long getInitial(){
		long ge;
		while(true) {
			if(n<10) {
				break;
			}
			while(true) {
				ge=n%10;
				k--;
				if(ge==0) {
					n/=10;
					if(k==0) {
					return n;
				}
					break;
				}
				n--;
				if(k==0) {
					return n;
				}
			}
		}
		return n;
	}

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		long n=input.nextLong();
		int k=input.nextInt();
		WrongSubtraction ws=new WrongSubtraction(n,k);
		ws.determine();
	}
}