# import sys; input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): S = input() T = input() if len(T) == 1: if S.count(T) == 0: print(0) else: print(-1) return T2 = T[:-1] + "." + T[-1] # print(T2) cnt = 0 # for i in range(10): while S.count(T) >= 1: S = S.replace(T, T2, 1) cnt += 1 # print(S) print(cnt) if __name__ == '__main__': main()