#include <bits/stdc++.h>
const int maxn = 100000 + 5;
const int mod = 1000000007;
char s[maxn], t[maxn];
int f[maxn], tot[maxn], next[maxn];
int main() {
  gets(s + 1);
  gets(t);
  int n = strlen(s + 1);
  int m = strlen(t);
  int k = next[0] = -1;
  for (int i = 1; i < m; i++) {
    for (; k >= 0 && t[k + 1] != t[i]; k = next[k])
      ;
    if (t[k + 1] == t[i]) k++;
    next[i] = k;
  }
  k = -1;
  int pre = -1;
  for (int i = 1; i <= n; i++) {
    for (; k >= 0 && t[k + 1] != s[i]; k = next[k])
      ;
    if (t[k + 1] == s[i]) k++;
    if (k + 1 == m) pre = i - m;
    f[i] = f[i - 1];
    if (pre >= 0) f[i] += tot[pre] + pre + 1;
    f[i] %= mod;
    tot[i] = (tot[i - 1] + f[i]) % mod;
  }
  printf("%d\n", f[n]);
  return 0;
}
