#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
long long choose(long long n, long long m) {
  if (m == 0)
    return 1;
  else
    return n * choose(n - 1, m - 1) / m;
}
int ans = 1, n, m;
string s1, s2;
bool can = 1;
set<int> st[26];
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) st[s1[i] - 'a'].insert(i);
  n = s1.size();
  m = s2.size();
  int cur = -1;
  for (int i = 0; i < m; i++) {
    int c = s2[i] - 'a';
    auto it = st[c].upper_bound(cur);
    if (it == st[c].end()) {
      ans++;
      it = st[c].upper_bound(-1);
      if (it == st[c].end()) {
        cout << -1;
        return 0;
      }
    }
    cur = *it;
  }
  cout << ans;
  return 0;
}
