#include<stdio.h>
int main()
{

    int N,K,s,diff,i;
    scanf("%d %d",&N,&K);
    for(i=0;i<=K-1;i++)
    {

        if (i==K-1)
        {
            s=N-i;
        }

    }
    diff=s-1;
    printf("%d",diff);

    return 0;
}
