#include #include int main() { int s, k; std::cin >> s >> k; std::cout << (s % k) << std::endl; return EXIT_SUCCESS; }