N,K = map(int,input().split()) C = 1 for i in range(N,N-K,-1): C *= i for i in range(2,K+1): C //= i ans = 0 while not(C & 1): ans += 1 C >>= 1 print(ans)