#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6, Mod = 1e9 + 7;
int f[maxn], ff[maxn], dp[maxn], dp2[maxn], dp3[maxn], ans;
string s, t, st;
int32_t main() {
  cin >> s >> t;
  st = t + '$' + s;
  int curr = 0;
  for (int i = 1; i < st.size(); i++) {
    while (curr != 0 && st[curr] != st[i]) curr = ff[curr];
    if (st[curr] == st[i]) curr++;
    ff[i + 1] = curr;
    if (i > t.size()) f[i - (int)t.size()] = curr;
  }
  for (int i = 1; i <= s.size(); i++) {
    if (f[i] == t.size())
      dp[i] = (dp[i] + (i - (int)t.size()) + 1 + dp3[i - (int)t.size()]) % Mod;
    else
      dp[i] = dp[i - 1];
    dp2[i] = (dp2[i - 1] + dp[i]) % Mod;
    dp3[i] = (dp3[i - 1] + dp2[i]) % Mod;
  }
  for (int i = 1; i <= s.size(); i++) {
    ans = (ans + dp[i]) % Mod;
  }
  cout << ans;
  return 0;
}
