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=readline().rstrip() T=readline().rstrip() ans=0 queue="" if len(T)==1 and T in S: ans=-1 else: for s in S: if len(queue)>=len(T)-1 and queue[len(queue)-len(T)+1:]==T[:-1] and s==T[-1]: queue+="." ans+=1 queue+=s print(ans)