S = input() T = input() c = S.count(T) if c > 0: if len(T) == 1: print(-1) else: print(c) else: print(0)