#include <bits/stdc++.h>
using namespace std;
int di[] = {1, 0, -1, 0};
int dj[] = {0, 1, 0, -1};
string a, b;
set<int> s[26];
int main(int argc, char *argv[]) {
  char temp[1000009];
  scanf("%s", temp);
  a = string(temp);
  scanf("%s", temp);
  b = string(temp);
  for (int i = 0; i < a.length(); ++i) {
    s[a[i] - 'a'].insert(i);
  }
  int last = -1, ans = 0;
  for (int i = 0; i < b.length(); ++i) {
    if (s[b[i] - 'a'].empty()) return cout << -1, 0;
    set<int>::iterator it = s[b[i] - 'a'].upper_bound(last);
    if (it == s[b[i] - 'a'].end()) {
      ans++;
      last = *s[b[i] - 'a'].begin();
    } else {
      last = *it;
    }
  }
  cout << ans + 1;
  return 0;
}
