#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
  int a,b; cin >> a >> b;
  int dis = b - a + 1;
  int ans = 0;
  while(dis > 1){
    int tmp = b / dis;
    if(a <= dis * (tmp -1)){
      cout << dis;
      return 0;
    }
    dis--;
  }
  cout << dis;
}
#include <bits/stdc++.h>
using namespace std;

int bs(vector<int> &arr, int n)
{
    int left = 0, right = arr.size() - 1;
    while(left <= right) {
        int mid = left + (right - left) / 2;
        if(arr[mid] == n) {
            return mid;
        }
        else if(arr[mid] > n) {
            right = mid - 1;
        }
        else {
            left = mid + 1;
        }
    }
    return -1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long int a, b;
    cin >> a >> b;
    long long int ans = abs(a - b);
    if(ans >= 3) {
        cout << "No\n";
    }
    else {
        cout << "Yes\n";
    }
}
