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