# https://open.kattis.com/problems/titlecost
# 1s
# 1.9 Easy

# Python3: 47 chars (Top 10, place 2, replaced by my Ruby program)
s,c=input().split();print(min(len(s),float(c)))
