S = str(input()) T = str(input()) S = S.replace(T,"#") ans = S.count("#") if len(T) == 1 and ans > 0: print(-1) elif ans == 0: print(0) else: print(ans)