/* -*- coding: utf-8 -*- * * 2142.cc: No.2142 Segment Zero - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 1000000; /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ /* main */ int main() { int n; ll k; scanf("%d%lld", &n, &k); ll r = (ll)n * (n + 1) / 2 - k; ll sum = 0; for (int i = 1, j = 1; i <= n; i++) { while (j <= n && sum < r) sum += j++; if (sum == r) { puts("1"); return 0; } sum -= i; } puts("2"); return 0; }