S = input() T = input() result = 0 p = 0 n = len(T) - 1 if n == 0: print(-1) exit() while True: p = S.find(T, p) if p == -1: break p += n result += 1 t = 0 while True: p = S.rfind(T, 0, p) if p == -1: break p += 1 t += 1 print(min(result, t))