#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i, n) for(int i = 0; i < (n); i++) #define per(i, n) for(int i = (n) - 1; i >= 0; i--) using ll = long long; #define vi vector #define vvi vector #define vl vector #define pii pair #define pll pair #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() constexpr int mod = 1000000007; using namespace std; template bool chmax(T &a, const U &b){ return a < b ? (a = b, 1) : 0; } template bool chmin(T &a, const U &b){ return a > b ? (a = b, 1) : 0; } int main(){ ll n,K; cin >> n >> K; K = n*(n+1)/2 - K; for(ll i = 1; i <= n; i++){ // length const ll v = K - i*(i-1)/2; if(v % i == 0 && 1 <= v/i && v/i <= n-i){ cout << "1\n"; return 0; } } K = n*(n+1)/2 - K; for(ll i = 1; i <= n; i++){ const ll v = K - i*(i-1)/2; if(v % i == 0 && 1 <= v/i && v/i <= n-i){ cout << "2\n"; return 0; } } }