#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
int mod = 1000000007;
db pie = 3.1415926535;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s1;
  cin >> s1;
  string s2;
  cin >> s2;
  vector<int> vis[26];
  int n = s1.size();
  int i;
  for (i = 0; i < n; i++) {
    vis[s1[i] - 'a'].push_back(i);
  }
  int m = s2.size();
  int p = -1;
  int cnt = 0;
  for (i = 0; i < m;) {
    if ((int)vis[s2[i] - 'a'].size() == 0) {
      cout << "-1"
           << "\n";
      return 0;
    }
    int j = 0;
    int k = (int)vis[s2[i] - 'a'].size() - 1;
    int ans = -1;
    while (j <= k) {
      int mid = (j + k) / 2;
      if (vis[s2[i] - 'a'][mid] > p) {
        ans = mid;
        k = mid - 1;
      } else {
        j = mid + 1;
      }
    }
    if (ans == -1) {
      p = -1;
    } else {
      if (p == -1) {
        cnt++;
      }
      p = vis[s2[i] - 'a'][ans];
      i++;
    }
  }
  cout << cnt << "\n";
}
