#yuki1005 s=input() t=input() if t==s: print(-1) elif len(t)==1 and t in s: print(-1) else: print(s.count(t))