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=S.count(T) if len(T)==1 and ans: ans=-1 print(ans)