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