{"raw_statement":[{"iden":"statement","content":"Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad.\n\nLet's consider the following algorithm of generating a sequence of integers. Initially we have a sequence consisting of a single element equal to 1. Then we perform (_n_ - 1) steps. On each step we take the sequence we've got on the previous step, append it to the end of itself and insert in the middle the minimum positive integer we haven't used before. For example, we get the sequence \\[1, 2, 1\\] after the first step, the sequence \\[1, 2, 1, 3, 1, 2, 1\\] after the second step.\n\nThe task is to find the value of the element with index _k_ (the elements are numbered from 1) in the obtained sequence, i. e. after (_n_ - 1) steps.\n\nPlease help Chloe to solve the problem!"},{"iden":"input","content":"The only line contains two integers _n_ and _k_ (1 ≤ _n_ ≤ 50, 1 ≤ _k_ ≤ 2_n_ - 1)."},{"iden":"output","content":"Print single integer — the integer at the _k_\\-th position in the obtained sequence."},{"iden":"examples","content":"Input\n\n3 2\n\nOutput\n\n2\n\nInput\n\n4 8\n\nOutput\n\n4"},{"iden":"note","content":"In the first sample the obtained sequence is \\[1, 2, 1, 3, 1, 2, 1\\]. The number on the second position is 2.\n\nIn the second sample the obtained sequence is \\[1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1\\]. The number on the eighth position is 4."}],"translated_statement":[{"iden":"statement","content":"Chloe 和 Vladik 一样，是一名竞赛程序员。她不像 Vladik 那样遇到任何困难就能进入竞赛，但她对竞赛中提出的题目感到困惑。\n\n让我们考虑以下生成整数序列的算法。最初，我们有一个仅包含一个元素 #cf_span[1] 的序列。然后我们执行 #cf_span[(n - 1)] 步。在每一步中，我们取上一步得到的序列，将其追加到自身末尾，并在中间插入之前未使用过的最小正整数。例如，第一步后我们得到序列 #cf_span[[1, 2, 1]]，第二步后得到序列 #cf_span[[1, 2, 1, 3, 1, 2, 1]]。\n\n任务是找到在经过 #cf_span[(n - 1)] 步后得到的序列中，索引为 #cf_span[k] 的元素的值（元素从 #cf_span[1] 开始编号）。\n\n请帮助 Chloe 解决这个问题！\n\n仅一行包含两个整数 #cf_span[n] 和 #cf_span[k]（#cf_span[1 ≤ n ≤ 50]，#cf_span[1 ≤ k ≤ 2n - 1]）。\n\n输出一个整数 —— 所得序列中第 #cf_span[k] 个位置的整数。\n\n在第一个样例中，所得序列为 #cf_span[[1, 2, 1, 3, 1, 2, 1]]。第二个位置的数是 #cf_span[2]。\n\n在第二个样例中，所得序列为 #cf_span[[1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1]]。第八个位置的数是 #cf_span[4]。"},{"iden":"input","content":"仅一行包含两个整数 #cf_span[n] 和 #cf_span[k]（#cf_span[1 ≤ n ≤ 50]，#cf_span[1 ≤ k ≤ 2n - 1]）。"},{"iden":"output","content":"输出一个整数 —— 所得序列中第 #cf_span[k] 个位置的整数。"},{"iden":"examples","content":"输入\n3 2\n输出\n2\n输入\n4 8\n输出\n4"},{"iden":"note","content":"在第一个样例中，所得序列为 #cf_span[[1, 2, 1, 3, 1, 2, 1]]。第二个位置的数是 #cf_span[2]。\n在第二个样例中，所得序列为 #cf_span[[1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1]]。第八个位置的数是 #cf_span[4]。"}],"sample_group":[],"show_order":[],"formal_statement":"Let $ S_n $ denote the sequence generated after $ n-1 $ steps, starting from $ S_1 = [1] $.\n\nFor $ n \\geq 2 $, the sequence is recursively defined as:\n$$\nS_n = S_{n-1} \\oplus [n] \\oplus S_{n-1}\n$$\nwhere $ \\oplus $ denotes concatenation.\n\nThe length of $ S_n $ is $ |S_n| = 2^n - 1 $.\n\nGiven integers $ n $ and $ k $ (with $ 1 \\leq n \\leq 50 $, $ 1 \\leq k \\leq 2^n - 1 $), find the value of the $ k $-th element of $ S_n $.\n\nDefine a function $ f(n, k) $ returning the value at position $ k $ in $ S_n $:\n\n- If $ n = 1 $, then $ f(1, 1) = 1 $.\n- Otherwise, let $ L = 2^{n-1} - 1 $ (length of $ S_{n-1} $).\n  - If $ k = L + 1 $, then $ f(n, k) = n $.\n  - If $ k \\leq L $, then $ f(n, k) = f(n-1, k) $.\n  - If $ k > L + 1 $, then $ f(n, k) = f(n-1, k - (L + 1)) $.\n\nCompute $ f(n, k) $.","simple_statement":null,"has_page_source":false}