#include <bits/stdc++.h>   using namespace std;   string s, t, x;   vector<int> lcp;   vector<bool> match;   constexpr int mxn = int(2e5) + 10;   int dp[mxn][3];   int pref[mxn];   const int mod = 1e9 + 7;   int ans(int start) {     if (dp[start][2] != -1) return dp[start][2];     if (start >= x.size()) return dp[start][0] = dp[start][1] = dp[start][2] = 0;     if (match[start]) {       dp[start][0] = dp[start][1] = 0;       int st = start + t.size() - 1;       int end = x.size() - 1;       int cnt = end - st + 1;       ans(st + 1);       dp[start][0] += cnt;       dp[start][0] %= mod;       dp[start][0] += pref[st + 1];       dp[start][0] %= mod;       dp[start][1] += ans(start + 1);       dp[start][1] %= mod;       dp[start][2] = (dp[start][0] + dp[start][1]) % mod;       pref[start] = pref[start + 1] + dp[start][2];       pref[start] %= mod;       return dp[start][2];     }     int curr = start;     while (curr < x.size() and not match[curr]) {       curr++;     }     ans(curr);     for (int i = curr - 1; i >= start; i--) {       dp[i][0] = dp[curr][0];       dp[i][1] = dp[i + 1][2];       dp[i][2] = dp[i][0] + dp[i][1];       dp[i][2] %= mod;       pref[i] = pref[i + 1] + dp[i][2];       pref[i] %= mod;     }     return dp[start][2];   }   void solve() {     cin >> s >> t;     x = t +  #  + s;     lcp = vector<int>(x.size());     match = vector<bool>(x.size());     lcp[0] = 0;     for (int i = 1; i < x.size(); i++) {       int j = lcp[i - 1];       while (j > 0 and x[j] != x[i]) j = lcp[j - 1];       if (x[j] == x[i]) j++;       lcp[i] = j;       if (lcp[i] == t.size()) {         match[i - t.size() + 1] = true;       }     }     cout << ans(t.size() + 1);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     memset(dp, -1, sizeof(dp));     memset(pref, 0, sizeof(pref));     solve();     return 0;   }   