#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5, mod = 1e9 + 7;
int dp[MAXN], par[MAXN], pre[MAXN];
string s, t;
vector<int> v;
vector<int> KMP(string S, string K) {
  vector<int> T(K.size() + 1, -1);
  vector<int> matches;
  if (K.size() == 0) {
    matches.push_back(0);
    return matches;
  }
  for (int i = 1; i <= K.size(); i++) {
    int pos = T[i - 1];
    while (pos != -1 && K[pos] != K[i - 1]) pos = T[pos];
    T[i] = pos + 1;
  }
  int sp = 0;
  int kp = 0;
  while (sp < S.size()) {
    while (kp != -1 && (kp == K.size() || K[kp] != S[sp])) kp = T[kp];
    kp++;
    sp++;
    if (kp == K.size()) matches.push_back(sp - K.size());
  }
  return matches;
}
int main() {
  cin >> s >> t;
  int n = s.length();
  par[0] = dp[0] = 1;
  v = KMP(s, t);
  fill(pre, pre + MAXN, -1);
  for (int i = 0; i < v.size(); i++) {
    int l = n;
    if (i < v.size() - 1) l = v[i + 1] + t.length() - 1;
    for (int j = v[i] + t.length() - 1; j < l; j++) pre[j] = v[i];
  }
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    if (pre[i - 1] >= 0) dp[i] = (dp[i] + par[pre[i - 1]]) % mod;
    par[i] = (par[i - 1] + dp[i]) % mod;
  }
  cout << (dp[n] - 1 + mod) % mod << endl;
  return 0;
}
