S = input() T = input() if len(T) == 1: if T in S: print("-1") else: print(S.count(T))