S = input() T = input() if len(T) == 1 and T in S: print(-1) elif len(T) > 1 and T.count(T[0]) == len(T): print(S.count(T[1:]) - 1) else: print(S.count(T))