#include <bits/stdc++.h>
using namespace std;
vector<int> getPartialMatch(const string& N) {
  vector<int> pi(N.size(), 0);
  int begin = 1, matched = 0;
  while (begin + matched < N.size()) {
    if (N[matched] == N[begin + matched]) {
      matched++;
      pi[begin + matched - 1] = matched;
    } else {
      if (matched == 0)
        begin++;
      else {
        begin += matched - pi[matched - 1];
        matched = pi[matched - 1];
      }
    }
  }
  return pi;
}
vector<int> kmpSearch(const string& H, const string& N) {
  vector<int> pi = getPartialMatch(N);
  vector<int> ret;
  int begin = 0, matched = 0;
  while (begin + N.size() <= H.size()) {
    if (matched < N.size() && N[matched] == H[begin + matched]) {
      matched++;
      if (matched == N.size()) ret.push_back(begin);
    } else {
      if (matched == 0)
        begin++;
      else {
        begin += matched - pi[matched - 1];
        matched = pi[matched - 1];
      }
    }
  }
  return ret;
}
vector<int> poss;
int main(void) {
  const long long MOD = 1000000007LL;
  string h, n;
  cin >> h >> n;
  poss = kmpSearch(h, n);
  int nSize = n.size();
  vector<bool> isGood(h.size(), false);
  for (int i = 0; i < poss.size(); i++) {
    poss[i] += nSize - 1;
    isGood[poss[i]] = true;
  }
  vector<long long> ans(h.size(), 0);
  vector<long long> q1(h.size(), 0), q2(h.size(), 0);
  for (int i = 0; i < isGood.size(); i++) {
    if (!isGood[i]) {
      if (i != 0) ans[i] = ans[i - 1];
    } else {
      ans[i] += i - nSize + 2;
      ans[i] += ((i - nSize) >= 0) ? q2[i - nSize] : 0;
    }
    q1[i] = ans[i];
    if (i != 0) q1[i] += q1[i - 1];
    q1[i] %= MOD;
    q2[i] = q1[i];
    if (i != 0) q2[i] += q2[i - 1];
    q2[i] %= MOD;
  }
  cout << q1[h.size() - 1] % MOD << endl;
  return 0;
}
