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

int main(){
    string S, T;
    cin >> S >> T;
    int j = 0;
    int ans = 0;
    int n = T.size();
    if (n == 1){
        if (S.find(T[0]) == string::npos){
            puts("0");
        } else {
            puts("-1");
        }
        return 0;
    }
    for (const auto &s: S){
        if (s == T[j]){
            j++;
            if (j == n){
                ans++;
                j = 0;
            }
        } else {
            j = 0;
        }
        if (j == 0 and s == T[0])
            j++;
    }
    cout << ans << endl;
}