#include <bits/stdc++.h>
using namespace std;
bool ok(string& s1, string& s2) {
  set<char> s((s1).begin(), (s1).end());
  for (int i = int(0); i < int(s2.size()); i++)
    if (s.find(s2[i]) == s.end()) return false;
  return true;
}
int main() {
  for (string s1, s2; cin >> s1 >> s2 && s1 != "#";) {
    if (!ok(s1, s2)) {
      cout << -1 << endl;
      continue;
    }
    vector<vector<int> > ps(26);
    for (int i = int(0); i < int(s1.size()); i++) ps[s1[i] - 'a'].push_back(i);
    int res = 1, j = 0;
    for (int i = 0; i < s2.size();) {
      vector<int>& p = ps[s2[i] - 'a'];
      int k = lower_bound((p).begin(), (p).end(), j) - p.begin();
      if (k == p.size()) {
        res++;
        j = 0;
      } else {
        j = p[k] + 1;
        i++;
      }
    }
    cout << res << endl;
  }
  return 0;
}
