#include <bits/stdc++.h>
using namespace std;
vector<int> adj[30];
int main() {
  string str1, str2;
  cin >> str1 >> str2;
  int len1 = str1.size(), len2 = str2.size();
  int i, j, k;
  for (i = 0; i < len1; i++) {
    adj[str1[i] - 'a'].push_back(i);
  }
  int ans = 1;
  int curr = -1;
  vector<int>::iterator it;
  for (i = 0; i < len2; i++) {
    int ind = str2[i] - 'a';
    if (adj[ind].size() == 0) {
      cout << "-1" << endl;
      return 0;
    }
    it = upper_bound(adj[ind].begin(), adj[ind].end(), curr);
    if (it == adj[ind].end()) {
      ans++;
      curr = adj[ind][0];
    } else {
      curr = *it;
    }
  }
  cout << ans << endl;
  return 0;
}
