#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  string s1, s2;
  cin >> s1 >> s2;
  bool vis[30] = {0};
  set<int> se[30];
  for (int i = 0; i < s1.size(); i++) vis[s1[i] - 'a'] = true;
  for (int i = 0; i < s2.size(); i++)
    if (!vis[s2[i] - 'a']) {
      cout << -1 << endl;
      return 0;
    }
  for (int i = 0; i < s1.size(); i++) se[s1[i] - 'a'].insert(i);
  int res = 0, last = -1;
  for (int i = 0; i < s2.size(); i++) {
    if (last == -1) {
      last = *se[s2[i] - 'a'].begin() + 1;
      if (last == s1.size()) last = -1;
      res++;
    } else {
      auto it = se[s2[i] - 'a'].lower_bound(last);
      if (it == se[s2[i] - 'a'].end()) {
        last = *se[s2[i] - 'a'].begin() + 1;
        if (last == s1.size()) last = -1;
        res++;
      } else
        last = *it + 1;
    }
  }
  cout << res << endl;
  return 0;
}
