Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. 
import java.util.*;
import java.lang.*;
import java.io.*;

public class  ER23C {
    static long s;
    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long n = in.nextLong();
        s = in.nextLong();
        long l = 0, h = n;
        while (l < h) {
            long mid = (l + h ) / 2;
           // System.out.println("mid is : " + mid);
           // System.out.println("high is : " + h);
            //System.out.println("low is : " + l);
            if (Ok(mid))
                h = mid;
            else
                l = mid + 1;
        }
        if (Ok(h))
            w.println(n - h + 1);
        else
            w.println(n - h);

        w.close();

    }
    static boolean Ok(long n) {
        int sum = 0;
        long temp = n;
        while (n > 0) {
            sum += (n % 10);
            n = n / 10;
        }
        //System.out.println("n is :" + n + " sum is : " + sum);
        return (temp - sum >= s);
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars =... Complexity: