S=input() s=input() ANS=S.replace(s,"A") ans=ANS.count("A") if ans>=1: if len(s)==1: print(-1) exit() else: print(ans) else: print(ans)