#include <bits/stdc++.h>
using namespace std;
vector<int> vec[26];
const int N = 1000005;
char s1[N], s2[N];
int main() {
  while (~scanf("%s%s", s1, s2)) {
    for (int i = 0; i < 26; i++) vec[i].clear();
    for (int i = 0; s1[i]; i++) vec[s1[i] - 'a'].push_back(i);
    bool ok = 1;
    int cur = -1;
    int res = 1;
    for (int i = 0; s2[i]; i++) {
      int id = s2[i] - 'a';
      if (vec[id].empty()) {
        ok = 0;
        break;
      } else {
        vector<int>::iterator it =
            upper_bound(vec[id].begin(), vec[id].end(), cur);
        if (it == vec[id].end()) {
          it = upper_bound(vec[id].begin(), vec[id].end(), -1);
          cur = *it;
          res++;
        } else {
          cur = *it;
        }
      }
    }
    if (ok)
      printf("%d\n", res);
    else
      puts("-1");
  }
  return 0;
}
