import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) D = {6:3,28:7,496:31,8128:127} K = {6:1,28:2,496:4,8128:6} N,H = mi() p = D[N] k = K[N] D = [1<