S, T = input(), input() ans = S.count(T) if len(T) == 1 and ans >= 1: print(-1) else: print(ans)