main(s,k){scanf("%d%d",&s,&k);printf("%d",s%k)&0;}