#include <iostream>
using namespace std;
int main(){
int n, m, ans;
while (cin >> n >> m){
if (n>m>=1) ans=m+1;
else ans=m;
cout << ans <<endl;
}