import Foundation
var s = String(readLine()!)
let t = String(readLine()!)
var q = s
var c = 0
if t.count == 1 && s.contains(t){
    print(-1)
}else if s.contains(t){
    let i = t.index(before: t.endIndex)
    let p = t[...t.index(before: i)] + "." + t[i...]
    while q.contains(t){
        let r = q.range(of: t)!
        q = q.replacingOccurrences(of: t, with: p,range: r)
    }
    print(q.count - s.count)
}else{
    print(q.count - s.count)
}