#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f, N = 1e2 + 5, mod = 1e9 + 7;
int ans, lst = OO, gt[26];
string s1, s2;
vector<int> idx[26];
int main() {
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); ++i) idx[s1[i] - 'a'].push_back(i);
  for (int i = 0; i < s2.size(); ++i) {
    int ch = s2[i] - 'a';
    if (!idx[ch].size()) exit(puts("-1"));
    if (idx[ch].back() > lst && idx[ch][gt[ch]] <= lst)
      gt[ch] =
          lower_bound(idx[ch].begin(), idx[ch].end(), lst) - idx[ch].begin();
    if (idx[ch].size() <= gt[ch] || idx[ch].back() <= lst) {
      ++ans, memset(gt, 0, sizeof gt);
      gt[ch] = 1, lst = idx[ch][0];
    } else
      lst = (idx[ch][gt[ch]++]);
  }
  cout << ans;
  return 0;
}
