#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  set<int> s[30];
  for (int i = 0; i < s1.size(); i++) s[s1[i] - 'a'].insert(i);
  int flag = -1;
  int ans = 1;
  for (int i = 0; i < s2.size(); i++) {
    int t = s2[i] - 'a';
    if (s[t].empty()) {
      puts("-1");
      return 0;
    }
    set<int>::iterator it = s[t].upper_bound(flag);
    if (it == s[t].end()) {
      flag = -1;
      ans++;
    }
    flag = *(s[t].upper_bound(flag));
  }
  printf("%d\n", ans);
  return 0;
}
