#include <bits/stdc++.h>
using namespace std;
const double pie1 = 3.1415926;
const double pie2 = 3.14159265358979;
const double pie3 = 3.14159265358979323846;
const double pie4 = 3.1415926535897932384626433832795;
const double pie5 =
    3.141592653589793238462643383279502884197199399372505820979944;
const int vbi = 999999999;
const int vli = -vbi;
const long long vbl = 999999999999999999;
const long long vll = -vbl;
const int minn = vli;
const long long minx = vll;
const int maxn = vbi;
const long long maxx = vli;
bool pss(int a) {
  for (int i = 2; i <= sqrt(a); i++)
    if (a % i == 0) return false;
  return true;
}
vector<int> v[27];
int main() {
  ios::sync_with_stdio(false);
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) v[s1[i] - 96].push_back(i);
  int sum = 1, ans = -1;
  for (int i = 0; i < s2.size(); i++) {
    if (v[s2[i] - 96].empty()) {
      cout << -1;
      return 0;
    }
    vector<int>::iterator it =
        lower_bound(v[s2[i] - 96].begin(), v[s2[i] - 96].end(), ans + 1);
    if (it == v[s2[i] - 96].end()) {
      sum++;
      ans = v[s2[i] - 96][0];
    } else
      ans = *it;
  }
  cout << sum;
  return 0;
}
