#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
long long f[110000], sum[110000], u[110000], p[110000], last[110000], g[110000];
char s1[110000], s2[110000];
int n, m;
int main() {
  int i, j;
  scanf("%s", s1);
  n = strlen(s1);
  scanf("%s", s2);
  m = strlen(s2);
  j = 0;
  for (i = 2; i <= m; i++) {
    while (s2[i - 1] != s2[j] && j) j = p[j];
    if (s2[i - 1] == s2[j]) j++;
    p[i] = j;
  }
  j = 0;
  for (i = 1; i <= n; i++) {
    while (s1[i - 1] != s2[j] && j) j = p[j];
    if (s1[i - 1] == s2[j]) {
      j++;
      if (j == m) {
        u[i] = 1;
        j = p[j];
      }
    }
  }
  for (i = 1; i <= n; i++) last[i] = u[i] ? i : last[i - 1];
  for (i = 1; i <= n; i++) {
    if (last[i]) {
      f[i] = last[i] - m + 1;
      f[i] = (f[i] + g[last[i] - m] - sum[last[i] - m] * (n - (last[i] - m))) %
             1000000007;
    }
    sum[i] = (sum[i - 1] + f[i]) % 1000000007;
    g[i] = (g[i - 1] + (n - i + 1) * f[i]) % 1000000007;
  }
  long long ans = (sum[n] + 1000000007) % 1000000007;
  printf("%lld\n", ans);
}
