#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const long long linf = 1e18 + 5;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int P = 27;
int dp[N], sum[N], sum_sum[N], power[N], something_stupid[N], val;
char a[N], b[N];
int n, m;
bool eq(int x) {
  return something_stupid[x + m - 1] - something_stupid[x - 1] * power[m] ==
         val;
  for (int i = 1; i <= m; i++)
    if (a[x + i - 1] != b[i]) return 0;
  return 1;
}
int main() {
  scanf("%s %s", a + 1, b + 1);
  n = strlen(a + 1);
  m = strlen(b + 1);
  power[0] = 1;
  for (int i = 1; i <= n; i++) power[i] = power[i - 1] * P;
  for (int i = 1; i <= n; i++)
    something_stupid[i] = something_stupid[i - 1] * P + a[i] - 'a' + 1;
  for (int i = 1; i <= m; i++) val = val * P + b[i] - 'a' + 1;
  int last = n + 1;
  for (int i = n; i >= 1; i--) {
    if (n - i + 1 >= m and eq(i)) last = i + m - 1;
    dp[i] = (sum_sum[last + 1] + (n - last + 1)) % mod;
    sum[i] = (sum[i + 1] + dp[i]) % mod;
    sum_sum[i] = (sum_sum[i + 1] + sum[i]) % mod;
  }
  cout << sum[1] << '\n';
  return 0;
}
