#include <bits/stdc++.h>
using namespace std;
short dp[10001][26];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  map<char, short> cmap;
  string s1, s2;
  cin >> s1 >> s2;
  long n = s1.size(), ans = 1, y = 0;
  for (int i = 0; i < 26; i++) dp[n][i] = -1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) dp[i][j] = dp[i + 1][j];
    cmap[s1[i]] = 1;
    dp[i][s1[i] - 97] = i;
  }
  for (long i = 0; i < s2.size(); i++) {
    if (cmap[s2[i]] == 0) {
      ans = -1;
      break;
    } else if (dp[y][s2[i] - 97] != -1) {
      y = dp[y][s2[i] - 97] + 1;
    } else {
      y = 0;
      i--;
      ans++;
    }
  }
  cout << ans;
  return 0;
}
