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