s=input() t=input() if len(t)==1 and s.count(t)>0: print(-1) exit() t_now=0 ans=0 for i in range(len(s)): if s[i] == t[t_now]: if t_now+1 == len(t): ans+=1 if t[-1] == t[0]: t_now=1 else: t_now=0 else: t_now+=1 elif s[i] == t[0]: t_now=1 else: t_now=0 print(ans)