s = input() t = input() u = s.replace(t, '.') if len(t)==1 and set(u)=={'.'}: print(-1) else: print(u.count('.'))