#include <bits/stdc++.h>
using namespace std;
char s[100010], t[100010];
int n, m, nxt[100010], mz[100010];
long long f[100010], sum[100010];
int main() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  nxt[1] = 0;
  for (int i = 2, j = 0; i <= m; i++) {
    while (j && t[i] != t[j + 1]) j = nxt[j];
    if (t[i] == t[j + 1]) j++;
    nxt[i] = j;
  }
  for (int i = 1, j = 1; i <= n; i++) {
    while (j && t[j + 1] != s[i]) j = nxt[j];
    if (s[i] == t[j + 1]) j++;
    if (j == m) mz[i] = i - m + 1;
  }
  for (int i = 1; i <= n; i++)
    if (!mz[i]) mz[i] = mz[i - 1];
  for (int i = 1, p; i <= n; i++) {
    f[i] = f[i - 1];
    p = mz[i];
    if (!p) continue;
    (f[i] += sum[p - 1] + p) %= 1000000007;
    sum[i] = (sum[i - 1] + f[i]) % 1000000007;
  }
  printf("%lld\n", f[n]);
  return 0;
}
