#include<stdio.h> int main() { int a,b,c; scanf("%d %d", &a, &b); if(a<-1000000||a>1000000||b<1||b>1000000) return 0; else c=a%b; if(c<0) return 0; else printf("%d\n", c); return 0; }