#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000001;
long long read() {
  char c = getchar();
  long long x = 0;
  int flag = 1;
  while (c < '0' || c > '9') {
    if (c == '-') flag = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - 48;
    c = getchar();
  }
  x *= flag;
  return x;
}
const int mod = 1e9 + 7;
char s[maxn], t[maxn];
int fail[maxn];
int flag[maxn];
int sum1[maxn], sum2[maxn];
int dp[maxn];
int main() {
  scanf("%s%s", s + 1, t + 1);
  int lena = strlen(s + 1), lenb = strlen(t + 1);
  for (int i = 2, j = 0; i <= lenb; i++) {
    while (j && t[i] != t[j + 1]) j = fail[j];
    if (t[i] == t[j + 1]) j++;
    fail[i] = j;
  }
  for (int i = 1, j = 0; i <= lena; i++) {
    while (j && s[i] != t[j + 1]) j = fail[j];
    if (s[i] == t[j + 1]) j++;
    if (j == lenb) {
      flag[i] = 1;
      j = fail[j];
    }
  }
  for (int i = 1; i <= lena; i++) {
    if (!flag[i])
      dp[i] = dp[i - 1];
    else {
      dp[i] = i - lenb + 1;
      dp[i] = (dp[i] + sum2[i - lenb]) % mod;
    }
    sum1[i] = (sum1[i - 1] + dp[i]) % mod;
    sum2[i] = (sum2[i - 1] + sum1[i]) % mod;
  }
  printf("%d", sum1[lena]);
  return 0;
}
