#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int pos = -1, ans;
set<int> q[300];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) {
    q[s1[i]].insert(i);
  }
  for (int i = 0; i < s2.size(); i++) {
    if (q[s2[i]].empty()) {
      return cout << "-1", 0;
    }
  }
  for (int i = 0; i < s2.size(); i++) {
    set<int>::iterator it = q[s2[i]].upper_bound(pos);
    if (it == q[s2[i]].end()) {
      ans++;
      pos = *q[s2[i]].begin();
    } else {
      pos = *it;
    }
  }
  cout << ans + 1;
}
