#include <bits/stdc++.h>
using namespace std;
const int inft = 1000000009;
const int MAXN = 1000006;
vector<int> kmp(string P, string &T) {
  P = "#" + P;
  int pi[P.size()], m = P.size() - 1, q = 0;
  pi[0] = pi[1] = 0;
  for (int i = 2; i <= m; ++i) {
    while (q && P[i] != P[q + 1]) q = pi[q];
    if (P[i] == P[q + 1]) ++q;
    pi[i] = q;
  }
  q = 0;
  vector<int> ans;
  for (int i = 0; i < T.size(); ++i) {
    while (q && T[i] != P[q + 1]) q = pi[q];
    if (T[i] == P[q + 1]) ++q;
    if (q == m) {
      ans.push_back(i - m);
      q = pi[q];
    }
  }
  return ans;
}
const int mod = 1000000007;
int pref[MAXN], t[MAXN];
void solve() {
  string P, T;
  int p, tek;
  cin >> T >> P;
  p = P.length();
  tek = T.length();
  vector<int> ans = kmp(P, T);
  for (typeof((ans).begin()) it = (ans).begin(); it != (ans).end(); ++it)
    (*it) += 2;
  t[0] = 1;
  pref[0] = 1;
  for (int i = 0; i < (tek + 1); ++i)
    if (i) {
      int w = lower_bound((ans).begin(), (ans).end(), i - p + 2) - ans.begin();
      if (w == 0)
        w = 0;
      else
        w = ans[w - 1];
      t[i] = (t[i - 1] + pref[w - 1]) % mod;
      pref[i] = (pref[i - 1] + t[i]) % mod;
    }
  printf("%d\n", (t[tek] - 1 + mod) % mod);
}
int main() {
  int t = 1;
  for (int i = 0; i < (t); ++i) solve();
  return 0;
}
