s = input() t = input() if set(list(t)) == set(["."]) and t in s or len(t) == 1: print(-1) else: ans = 0 tmp = "" for c in s: if len(tmp) == len(t): tmp = tmp[1:] tmp += c if tmp == t: ans += 1 tmp = tmp[-1] print(ans)