s = str(input()) t = str(input()) if len(t) == 1: print(-1) exit() import re m = re.findall(t, s) if len(t) == 1: if len(m) != 0: print(-1) else: print(0) else: print(len(m))