#include <bits/stdc++.h>
using namespace std;
char s[100010], t[100010];
int n, m, i, f[100010], g[100010], p[100010], Ed[100010], G[100010];
void Next() {
  int j = 0;
  p[1] = 0;
  for (i = 2; i <= m; i++) {
    while (j && t[i] != t[j + 1]) j = p[j];
    if (t[j + 1] == t[i]) ++j;
    p[i] = j;
  }
}
void Kmp() {
  int j = 0;
  for (i = 1; i <= n; i++) {
    while (j && t[j + 1] != s[i]) j = p[j];
    if (t[j + 1] == s[i]) j++;
    if (j == m) Ed[i] = true;
  }
}
int main() {
  scanf("%s\n%s", s + 1, t + 1);
  n = strlen(s + 1), m = strlen(t + 1);
  Next();
  Kmp();
  for (i = 1; i <= n; i++) {
    if (Ed[i])
      f[i] = (i - m + 1 + G[i - m]) % 1000000007;
    else
      f[i] = f[i - 1];
    g[i] = (g[i - 1] + f[i]) % 1000000007;
    G[i] = (G[i - 1] + g[i]) % 1000000007;
  }
  printf("%d\n", g[n]);
  return 0;
}
