#include <bits/stdc++.h>
char s1[100005], s2[100005];
int nr1, nr2, q, pi[100005];
int f[100005], last, sol[100005];
int sol2[100005];
int main() {
  int i;
  scanf("%s", s1);
  scanf("%s", s2);
  nr1 = strlen(s1);
  nr2 = strlen(s2);
  for (i = nr1; i >= 1; i--) s1[i] = s1[i - 1];
  for (i = nr2; i >= 1; i--) s2[i] = s2[i - 1];
  for (i = 2; i <= nr2; i++) {
    while (q > 0 && s2[q + 1] != s2[i]) q = pi[q];
    if (s2[q + 1] == s2[i]) q++;
    pi[i] = q;
  }
  q = 0;
  for (i = 1; i <= nr1; i++) {
    while (q > 0 && s1[i] != s2[q + 1]) q = pi[q];
    if (s1[i] == s2[q + 1]) q++;
    if (q == nr2) {
      f[i - nr2 + 1] = 1;
    }
  }
  last = -1;
  for (i = nr1; i >= 1; i--) {
    if (f[i] == 1) last = i;
    if (last == -1) continue;
    sol[i] = (sol[i + 1] + sol2[last + nr2] + nr1 - (last + nr2 - 1) + 1) %
             1000000007;
    sol2[i] = (sol2[i + 1] + sol[i]) % 1000000007;
  }
  printf("%d\n", sol[1]);
  return 0;
}
