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