s = input() t = input() if len(t) == 1 and s.count(t) > 0: print(-1) else: print(s.count(t))