S = input() T = input() if len(T) == 1 and S.count(T) == 0 : print(0) elif len(T) == 1: print("-1") else:print(S.count(T))