from collections import defaultdict import sys from typing import Counter readline=sys.stdin.readline write=sys.stdout.write from math import gcd as GCD import math S=list(readline().rstrip()) T=list(readline().rstrip()) ans=0 queue=[] if len(T)==1 and T[0] in S: ans=-1 else: for s in S: if len(queue)>=len(T)-1 and queue[len(queue)-len(T)+1:]==T[:-1]: queue.append(".") ans+=1 queue.append(s) print(ans)