#include <bits/stdc++.h>
using namespace std;

int maxp, jury;

bool smaller(int x) {
    return (jury < x);
}

int find_number(int MAX) {
    for (int i = 1; i <= MAX; i ++) {
        if (smaller(i)) return i;
    }
    return -1;
}

int main() {
    cin >> maxp >> jury;
    cout << find_number(maxp);
    return 0;
}
