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