#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
vector<long long> v[40];
map<char, long long> us;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  string a;
  cin >> a;
  for (long long i = 0; i < a.size(); i++) {
    long long x = int(a[i]) - 97;
    v[x].push_back(i);
    us[a[i]] = 1;
  }
  string b;
  cin >> b;
  long long x = -1, ans = 0;
  for (long long i = 0; i < b.size(); i++) {
    if (!us[b[i]]) {
      cout << -1;
      return 0;
    }
    long long l = 0, r = v[int(b[i]) - 97].size() - 1, y = int(b[i]) - 97;
    while (l + 1 < r) {
      long long d = (l + r) / 2;
      if (v[y][d] > x)
        r = d;
      else
        l = d;
    }
    if (v[y][l] <= x && v[y][r] <= x)
      ans++, x = v[y][0];
    else if (v[y][l] > x)
      x = v[y][l];
    else if (v[y][r] > x)
      x = v[y][r];
  }
  cout << ans + 1;
  return 0;
}
