S = input() T = input() ans = S.count(T) if len(T) == 1: ans = -1 if ans == len(S): ans //= len(T) print(ans)