#include <bits/stdc++.h>
using namespace std;
char a[100010], b[100010];
int f[100010], g[100010], sum[100010], ok[100010], Next[100010], N, M;
inline void GetNext() {
  Next[1] = 0;
  for (int i = 2, j = 0; i <= M; i++) {
    while (j && b[j + 1] != b[i]) j = Next[j];
    if (b[j + 1] == b[i]) ++j;
    Next[i] = j;
  }
}
inline void KMP() {
  for (int i = 1, j = 0; i <= N; i++) {
    while (j && b[j + 1] != a[i]) j = Next[j];
    if (b[j + 1] == a[i]) ++j;
    if (j == M) ok[i] = 1;
  }
}
int main() {
  scanf("%s%s", a + 1, b + 1);
  N = strlen(a + 1), M = strlen(b + 1);
  GetNext();
  KMP();
  for (int i = 1; i <= N; i++)
    if (!ok[i])
      f[i] = f[i - 1], g[i] = (g[i - 1] + f[i]) % 1000000007,
      sum[i] = (sum[i - 1] + g[i]) % 1000000007;
    else
      f[i] = sum[i - M] + i - M + 1, g[i] = (g[i - 1] + f[i]) % 1000000007,
      sum[i] = (sum[i - 1] + g[i]) % 1000000007;
  printf("%d\n", g[N]);
  return 0;
}
