S = input() T = input() if len(T)==1: print(-1) exit() ans = 0 s = S while T in s: i = s.index(T) ans += 1 s = s[:i+len(T)-1] + '.' + s[i+len(T)-1:] ans2 = 0 s = S[::-1] t = T[::-1] while t in s: i = s.index(t) ans2 += 1 s = s[:i+len(t)-1] + '.' + s[i+len(t)-1:] print(min(ans, ans2))