#include using namespace std; int main(){ int N,K; int NO=0; cin>>N>>K; if(N+1-K<=N&&N+1-K>=1) NO++; if(K>=1&&K<=N) NO++; if(NO==0) cout<<"0"<