#include <bits/stdc++.h> using namespace std; int n,m; int main(){ scanf("%d%d",&n,&m); printf("%d\n",min(n>>1,m)); return 0; }