#include <bits/stdc++.h>
const int maxn = 100005;
const long long mod = 1e9 + 7;
char s[maxn], t[maxn];
int flag[maxn], p[maxn], jump[maxn];
long long sum[maxn], g[maxn], f[maxn];
void kmp(char a[], char b[]) {
  int j = -1, lena = strlen(a), lenb = strlen(b);
  p[0] = -1;
  for (int i = 1; i < lenb; ++i) {
    while (j >= 0 && b[j + 1] != b[i]) j = p[j];
    if (b[j + 1] == b[i]) ++j;
    p[i] = j;
  }
  j = -1;
  for (int i = 0; i < lena; ++i) {
    while (j >= 0 && b[j + 1] != a[i]) j = p[j];
    if (b[j + 1] == a[i]) ++j;
    if (j == lenb - 1) {
      flag[i - lenb + 1] = 1;
      j = p[j];
    }
  }
}
int main() {
  scanf("%s%s", s, t);
  kmp(s, t);
  int lena = strlen(s), lenb = strlen(t);
  jump[lena] = lena;
  for (int i = lena - 1; i >= 0; --i)
    if (flag[i])
      jump[i] = i + lenb - 1;
    else
      jump[i] = jump[i + 1];
  for (int i = lena - 1; i >= 0; --i) {
    f[i] = (g[jump[i] + 1] + lena - jump[i]) % mod;
    f[i] = (f[i] - (sum[jump[i] + 1] * jump[i]) % mod + mod) % mod;
    sum[i] = (sum[i + 1] + f[i]) % mod;
    g[i] = (g[i + 1] + (f[i] * i) % mod) % mod;
  }
  printf("%I64d\n", sum[0]);
  return 0;
}
