import re S = input() T = input() text = re.compile(r"{}".format(T)) result = re.findall(text, S) if len(T) == 1: print(-1) else: print(len(result))