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