s=input() t=input() if s==t and len(s)==1: print("-1") else: print(s.count(t))