use std::collections::VecDeque;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let s: Vec<_> = sc.read::<String>().bytes().collect();
    let t: Vec<_> = sc.read::<String>().bytes().collect();
    let n_s = s.len();
    let n_t = t.len();

    let mut array = t.clone();
    let n_s = (n_t + n_s - 1) / n_s * n_s;
    while array.len() < n_t + n_s * 2 {
        array.extend(s.clone());
    }

    let z_array = z_algorithm::calc_z_array(&array);
    let mut jump = vec![false; n_s];
    for i in 0..n_s {
        jump[i] = z_array[i + n_t] >= n_t;
    }

    let mut ans = vec![None; n_s];
    let mut q = VecDeque::new();
    for i in 0..n_s {
        if !jump[i] {
            ans[i] = Some(0);
            q.push_back(i);
        }
    }
    if q.is_empty() {
        println!("-1");
        return;
    }

    while let Some(pos) = q.pop_front() {
        let prev = if pos < n_t {
            pos + n_s - n_t
        } else {
            pos - n_t
        };
        if ans[prev].is_some() {
            continue;
        }
        if jump[prev] {
            ans[prev] = Some(ans[pos].unwrap() + 1);
        } else {
            ans[prev] = Some(0);
        }
        q.push_back(prev);
    }

    if ans.contains(&None) {
        println!("-1");
        return;
    }

    let ans = ans.into_iter().map(|ans| ans.unwrap()).max().unwrap();
    println!("{}", ans);
}
pub mod z_algorithm {

    pub fn calc_z_array<T: PartialEq>(s: &[T]) -> Vec<usize> {
        let n = s.len();
        let mut z_array = vec![0; n];

        // [l, r) is a window which matches with prefix of s
        let mut l = 0;
        let mut r = 1;
        for i in 1..n {
            if i >= r {
                l = i;
                r = i + 1;
                while r <= n && s[r - 1 - l] == s[r - 1] {
                    r += 1;
                }
                z_array[i] = r - l - 1;
                r -= 1;
            } else {
                if z_array[i - l] < r - i {
                    z_array[i] = z_array[i - l];
                } else {
                    l = i;
                    while r <= n && s[r - 1 - l] == s[r - 1] {
                        r += 1;
                    }
                    z_array[i] = r - l - 1;
                    r -= 1;
                }
            }
        }
        z_array[0] = n;
        z_array
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 50684