S=input() T=input() U=(T[:len(T)-1]+"."+T[-1]) S=S.replace(T,U) if T in S: print(-1) else: print(S.count("."))