use std::cmp;
use std::cmp::max;
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 mut s = sc.chars();
    let mut t = sc.chars();

    while s.len() < t.len() {
        let t = s.clone();
        s.extend(t);
    }
    let x = s.clone();
    s.extend(x);

    let n_s = s.len() / 2;
    let n_t = t.len();
    t.extend(s);

    let z_array = z_algorithm::calc_z_array(&t);
    let mut length = vec![0; n_s];
    for i in 0..n_s {
        length[i] = cmp::min(z_array[i + n_t], n_t);
    }

    let mut vis = vec![false; n_s];
    for i in 0..n_s {
        if vis[i] {
            continue;
        }
        vis[i] = true;
        if length[i] != n_t {
            continue;
        }
        let mut cur = (i + n_t) % n_s;
        while !vis[cur] {
            vis[cur] = true;
            if length[cur] != n_t {
                break;
            }
            cur = (cur + n_t) % n_s;
        }
        if cur == i {
            println!("-1");
            return;
        }
    }

    let mut max_i = 0;
    for i in 0..n_s {
        if length[i] == n_t {
            continue;
        }
        let mut cur = i;
        let mut ans = 0;
        loop {
            let prev = (cur + n_s - n_t) % n_s;
            if length[prev] == n_t {
                cur = prev;
                ans += 1;
            } else {
                break;
            }
        }
        max_i = max(max_i, ans);
    }
    println!("{}", max_i);
}

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) -> Self {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().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: 43560