use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let s: &str = itr.next().unwrap(); let t: &str = itr.next().unwrap(); if t.len() == 1 && s.find(t) != None { println!("-1"); return; } let s = format!("{}{}", t, s); let s: Vec = s.chars().collect(); let n = s.len(); let mut a: Vec = vec![0; s.len()]; a[0] = n; let mut i = 1; let mut j = 0; while i < n { while i + j < n && s[j] == s[i + j] { j += 1; } a[i] = j; if j == 0 { i += 1; continue; } let mut k = 1; while i + k < n && k + a[k] < j { a[i + k] = a[k]; k += 1; } i += k; j -= k; } let mut ans = 0; let mut i = t.len(); while i < n { if a[i] >= t.len() { ans += 1; i += t.len() - 1; } else { i += 1; } } println!("{}", ans); }