#include <bits/stdc++.h>
using namespace std;
string s, t;
long long ans = 0;
vector<vector<int> > v;
vector<int> vv;
bool check[35];
int binary(int x, int i) {
  int low = 0, high = v[i].size() - 1, mid;
  while (low < high) {
    mid = (low + high) / 2;
    if (v[i][mid] < x)
      low = mid + 1;
    else
      high = mid;
  }
  return low;
}
int main() {
  memset(check, 0, sizeof check);
  v.assign(35, vv);
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++) {
    v[s[i] - 'a'].push_back(i);
    check[s[i] - 'a'] = 1;
  }
  for (int i = 0; i < t.length(); i++) {
    if (check[t[i] - 'a'] == 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  int last = -1;
  for (int i = 0; i < t.length(); i++) {
    if (v[t[i] - 'a'].back() > last) {
      int r = binary(last + 1, t[i] - 'a');
      if (v[t[i] - 'a'][r] == s.length() - 1) {
        ans++;
        last = -1;
      } else {
        last = v[t[i] - 'a'][r];
      }
    } else {
      ans++;
      if (v[t[i] - 'a'][0] == s.length() - 1) {
        ans++;
        last = -1;
      } else
        last = v[t[i] - 'a'][0];
    }
  }
  if (last != -1) ans++;
  cout << ans << endl;
  return 0;
}
