#include <bits/stdc++.h>
using namespace std;
map<char, set<int> > m;
int ans = 1;
int main() {
  string a, b;
  cin >> a >> b;
  int lena = (int)a.length(), lenb = (int)b.length();
  set<int> s;
  for (int i = (0); i < (lena); ++i) {
    s.insert(i);
    if (!m.insert(make_pair(a[i], s)).second) m[a[i]].insert(i);
    s.erase(i);
  }
  int pos = 0;
  for (int i = (0); i < (lenb); ++i)
    if (m.find(b[i]) == m.end()) {
      cout << "-1";
      return 0;
    } else {
      if (pos >= lena) {
        pos = *m[b[i]].begin() + 1;
        ++ans;
        continue;
      }
      set<int>::iterator it = m[b[i]].lower_bound(pos);
      if (it == m[b[i]].end()) {
        pos = *m[b[i]].begin() + 1;
        ++ans;
      } else
        pos = *it + 1;
    }
  cout << ans;
  return 0;
}
