import sys s=input() t=input() if len(t)<2: if s.find(t)<0: print(0) sys.exit() print(-1) else: n=len(t) k=0 for i in range(len(s)): k=s.find(t,k) if k<0: print(i) sys.exit() k+=n-1 print(k)