import std.stdio; void main() { ulong s, k; readf("%s %s", &s, &k); writeln(s % k); }