#include <bits/stdc++.h>
using namespace std;
char a[111111], b[111111];
int f[111111], pos[111111];
int sum[111111], dp[111111];
int n, m;
void getfial() {
  int j;
  f[0] = j = -1;
  for (int i = 1; i < m; i++) {
    while (j != -1 && b[i] != b[j + 1]) j = f[j];
    if (b[i] == b[j + 1]) j++;
    f[i] = j;
  }
}
void find() {
  int j = -1;
  for (int i = 0; i < n; i++) {
    while (j != -1 && a[i] != b[j + 1]) j = f[j];
    if (a[i] == b[j + 1]) j++;
    if (j == m - 1) {
      pos[i] = i - m + 2;
      j = f[j];
    }
  }
}
int main() {
  scanf("%s%s", a, b);
  n = strlen(a), m = strlen(b);
  getfial();
  find();
  for (int i = 1; i < n; i++)
    if (!pos[i]) pos[i] = pos[i - 1];
  for (int i = 0; i < n; i++) {
    dp[i] = dp[i - 1];
    if (pos[i]) dp[i] = (dp[i] + sum[pos[i] - 2] + pos[i]) % 1000000007;
    sum[i] = (sum[i - 1] + dp[i]) % 1000000007;
  }
  printf("%d\n", dp[n - 1]);
  return 0;
}
