import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.container, std.math;

immutable int mod = 10^^9 + 7;

long n, s;

void main() {
    readVariables(n, s);

    long top, btm, mid;

    if (n - dsum(n) < s) {
        writeln(0);
        return;
    }

    top = n;

    while (top - btm > 1) {
        mid = btm + (top - btm) / 2;

        debug {
            writeln(mid, " ", dsum(mid));
        }

        if (mid - dsum(mid) >= s) {
            top = mid;
        }
        else {
            btm = mid;
        }
    }

    long ans = n - top + 1;

    writeln(ans);
}

long dsum(long mid) {
    return mid > 0 ? dsum(mid / 10) + mid % 10 : 0;
}

void readVariables(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg ; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if (!line.empty) {
        throw new Exception("args num < input num");
    }
}