S = input() T = input() cnt = S.count(T) if len(T) == 1 and cnt == 0: print(cnt) elif len(T) == 1 and cnt != 0: print(-1) else: print(cnt)