#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

/*
class KMP{
  private:
    string S;
    string W;
    vector<ll> T;
    vector<bool> flag;

  public:
    void make_table(void){
      T.resize(W.size());
      ll i = 2;
      ll j = 0;
      T[0] = -1;
      T[1] = 0;

      while(i<W.size()){
        if(W[i-1]==W[j]){
          T[i] = j+1;
          i++;
          j++;
        }else if(j>0){
          j = T[j];
        }else{
          T[i] = 0;
          i++;
        }
      }
      return;
    }

    KMP(string s, string w){
      S = s;
      W = w;
      make_table();
      flag.resize(S.size(), false);
      return;
    };

    ~KMP(void){
      return;
    };

    ll local_search(ll start){
      ll m = 0; // the start position in S
      ll i = start; // the start position in W

      while(m+i<S.size()){
        if(W[i] == S[m+i]){
          i++;
          if(i==W.size()) return m;
        }else{
          m+=i-T[i];
          if(i>0) i=T[i];
        }
      }
      return -1;
    };

    void total_search(void){
      ll m = 0; // the start position in S
      ll i = 0; // the start position in W

      while(m+i<S.size()){
        if(W[i] == S[m+i]){
          i++;
          if(i==W.size()){
            flag[m] = true;
            m++;
            i=0;
          }
        }else{
          m+=i-T[i];
          if(i>0) i=T[i];
        }
      }
      return;
    };

    bool start_check(ll start){
      return flag[start];
    };
};
*/

class Z_algorithm{
  public:
    string S;
    vector<ll> A;
    Z_algorithm(string s){
      S = s;
      A.resize(S.size());
      return;
    };

    ~Z_algorithm(void){
      return;
    };

    void calc(void){
      A[0] = S.size();
      ll i=1, j=0;
      while(i<S.size()){
        while(i+j < S.size() && S[j] == S[i+j]) ++j;
        A[i] = j;
        if(j==0){
          ++i;
          continue;
        }
        ll k=1;
        while(i+k<S.size() && k+A[k]<j){
          A[i+k] = A[k];
          ++k;
        }
        i += k;
        j -= k;
      }
      return;
    };

    void calc(string W){
      S = W+S;
      A.resize(S.size());
      calc();
      return;
    };
};

vll dp;
vll jump;
bool total_flag = true;

ll calc(ll pos, const ll init){
  ll n_pos = jump[pos];
  if(n_pos<0){
    return dp[pos] = 0;
  }
  if(n_pos==init){
    total_flag = false;
    return -2;
  }
  if(dp[pos]>=0) return dp[pos];
  return dp[pos] = calc(n_pos, init) + 1;
}

int main(){
  string s_base, t_base;
  IN(s_base);
  IN(t_base);

  string s = s_base;
  string t = t_base;

  while(s.size()<t.size()){
    s += s_base;
  }

  ll s_count = s.size();
  s += s;

  jump.resize(s_count);
  REP(i,s_count) jump[i] = -1;

  /*
  REP(s_start, s_base.size()){
    bool flag = true;
    REP(t_diff,t.size()){
      if(s[t_diff+s_start] != t[t_diff]){
        flag = false;
        break;
      }
    }
    if(!flag) continue;

    jump[s_start] = (s_start + t.size())%s_base.size();
  }
  */

  /*
  KMP kmp(s, t);
  kmp.total_search();
  REP(i,s_base.size()){
    if(!kmp.start_check(i)) jump[i] = -1;
    else jump[i] = (i+t.size())%s_base.size();
  }
  */

  Z_algorithm ZA(s);
  ZA.calc(t);
  REP(i,s_count){
    if(ZA.A[t.size()+i] < t.size()) continue;
    jump[i] = (i+t.size())%s_count;
  }

  REP(i,s_base.size()){
    //printf("%lld %lld\n", i, jump[i]);
  }

  dp.resize(jump.size());
  REP(i,dp.size()){
    dp[i] = -1;
  }

  REP(i,dp.size()){
    calc(i, i);
    if(!total_flag) break;
  }

  ll ans = 0;
  REP(i,dp.size()){
    ans = max(ans, dp[i]);
    //printf("%lld %lld\n", i, dp[i]);
  }

  if(total_flag){
    printf("%lld\n", ans);
  }else{
    printf("-1\n");
  }


  return 0;
}


Measured memory_bytes: 50484