#include using namespace std; using ll = long long; int main () { ll N, K; cin >> N >> K; K = (N * (N + 1)) / 2 - K; K *= 2; for (ll x = 1; x * x <= K; x ++) { if (K % x) { continue; } ll y = K / x; if ((x + y) % 2 == 0) { continue; } ll a = (y + (x - 1)) / 2, b = (y - (x - 1)) / 2; if (1 <= b && a <= N) { cout << 1 << endl; return 0; } } cout << 2 << endl; }