#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int maxn = 2e5 + 10;
const long long INF = 1e9;
const int logmaxn = 22;
void getfail(char* P, int* f) {
  int n = strlen(P);
  f[0] = 0;
  f[1] = 0;
  for (int i = 1; i < n; i++) {
    int j = f[i];
    while (j && P[i] != P[j]) j = f[j];
    f[i + 1] = (P[i] == P[j] ? j + 1 : 0);
  }
}
void getfail(int* P, int* f, int n) {
  f[0] = 0;
  f[1] = 0;
  for (int i = 1; i < n; i++) {
    int j = f[i];
    while (j && P[i] != P[j]) j = f[j];
    f[i + 1] = (P[i] == P[j] ? j + 1 : 0);
  }
}
vector<int> find(char* T, char* P, int* f) {
  int n = strlen(T), m = strlen(P);
  getfail(P, f);
  vector<int> ans;
  int j = 0;
  for (int i = 0; i < n; ++i) {
    while (j && P[j] != T[i]) j = f[j];
    if (P[j] == T[i]) ++j;
    if (j == m) ans.push_back(i - m + 1), j = f[j];
  }
  return ans;
}
int n, m;
char s[maxn], w[maxn];
int f[maxn];
int le[maxn];
int dp[maxn], s1[maxn], s2[maxn];
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> s >> w;
  int n = strlen(s), lw = strlen(w);
  auto v = find(s, w, f);
  for (auto& r : v) r += (lw);
  memset(le, 0, sizeof(le));
  for (int t = (0); t < (v.size()); ++t) {
    if (t < v.size() - 1) {
      for (int i = v[t]; i < v[t + 1]; ++i) le[i] = v[t];
    } else {
      for (int i = v[t]; i <= n; ++i) le[i] = v[t];
    }
  }
  memset(dp, 0, sizeof(dp)), memset(s1, 0, sizeof(s1)),
      memset(s2, 0, sizeof(s2));
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (!le[i])
      dp[i] = 0;
    else {
      if (le[i] >= lw) dp[i] = le[i] - lw + 1 + s2[le[i] - lw];
      dp[i] %= mod;
    }
    s1[i] = s1[i - 1] + dp[i];
    s1[i] %= mod;
    s2[i] = s2[i - 1] + s1[i];
    s2[i] %= mod;
    ans = (ans + dp[i]) % mod;
  }
  cout << ans;
}
