/*
* hdu2175/win.cpp
* Created on: 2012-8-2
* Author : ben
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <functional>
#include <numeric>
#include <cctype>
using namespace std;
typedef unsigned long long I64u;
I64u powoftwo[64];
void init() {
powoftwo[0] = 1;
for(int i = 1; i < 64; i++) {
powoftwo[i] = powoftwo[i - 1] * 2;
}
}
int work(I64u m) {
for(int i = 0; i < 64; i++) {
if(m == powoftwo[i]) {
return i;
}
}
for(int i = 63; i >= 0; i--) {
if(m > powoftwo[i]) {
return -i;
}
}
return 0;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("data.in", "r", stdin);
#endif
int n;
I64u m;
init();
while(scanf("%d%I64u", &n, &m) == 2) {
if(m == 0 && n == 0) {
break;
}
int ret = work(m);
while(ret < 0) {
m -= powoftwo[-ret];
ret = work(m);
}
printf("%d\n", ret + 1);
}
return 0;
}