#include <bits/stdc++.h>
using namespace std;
vector<int> T;
int n, nn, m;
int summ(int x) {
  int res = 0;
  for (; x >= 0; x = (x & (x + 1)) - 1) res += T[x];
  return res;
}
void add(int x, int val) {
  for (; x < nn; x |= x + 1) T[x] += val;
}
int a1[26], a2[26];
int main() {
  string s1, s2, s3, s4;
  cin >> s1 >> s2;
  for (int i = 0; i < s1.length(); i++) {
    a1[s1[i] - 'a']++;
  }
  for (int i = 0; i < s2.length(); i++) {
    a2[s2[i] - 'a']++;
  }
  int m = max(s1.length(), s2.length());
  bool f = true;
  for (int i = 0; i < 26; i++) {
    if (a1[i] == 0 && a2[i]) {
      cout << -1;
      return 0;
    }
  }
  long long ans = 1;
  vector<set<int> > pos(26, set<int>());
  for (int i = 0; i < s1.length(); i++) {
    pos[s1[i] - 'a'].insert(i);
  }
  int prev = -1;
  int cur;
  set<int>::iterator it;
  for (int i = 0; i < s2.length(); i++) {
    cur = s2[i] - 'a';
    it = pos[cur].upper_bound(prev);
    if (it == pos[cur].end()) {
      ans++;
      prev = *pos[cur].begin();
      continue;
    }
    if (it != pos[cur].end()) {
      prev = *it;
      continue;
    }
  }
  cout << ans;
  return 0;
}
