#include <stdio.h>

main(int argc, char **argv)
{
   printf("%d\n", atoi(argv[1]) % atoi(argv[2]));
}