#include #include using namespace std; using mint = atcoder::modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long N, K; cin >> N >> K; K = N * (N + 1) / 2 - K; if (K == 0) { cout << 0 << endl; return 0; } set S; long sum = 0; for (int i = 0; i <= N; i++) { sum += i; S.insert(sum); } for (long s : S) { if (S.count(s + K)) { cout << 1 << endl; return 0; } } cout << 2 << endl; }