#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; const ll MOD = 1000000007; const ll INF = 2147483647; const ll LINF = 9223372036854775807; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() int main() { string s, t; cin >> s >> t; int n = s.size(), m = t.size(); int p = 0; int ans = 0; REP(i,n){ if(s[i] == t[p]){ p++; if(p == m){ ans++; if(m != 1) i--; p = 0; } } } if(m == 1){ if(ans == 0){ cout << 0 << endl; } else{ cout << -1 << endl; } } else{ cout << ans << endl; } return 0; }