#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int MAXN = 100010;
int p[100010], val[100010], dp[100010], sum[100010];
int main() {
  char s1[100050], s2[100400];
  int l1, l2;
  scanf("%s%s", s1 + 1, s2 + 1);
  l1 = strlen(s1 + 1), l2 = strlen(s2 + 1);
  int j = 0;
  p[1] = 0;
  for (int i = 2; i <= l2; i++) {
    j = p[i - 1];
    while (j > 0 && s2[i] != s2[j + 1]) j = p[j];
    if (s2[i] == s2[j + 1])
      p[i] = j + 1;
    else
      p[i] = 0;
  }
  int ans = 0, last = 0;
  j = 0;
  for (int i = 1; i <= l1; i++) {
    while (j > 0 && s1[i] != s2[j + 1]) j = p[j];
    if (s1[i] == s2[j + 1]) j++;
    if (j == l2) j = p[j], val[i] = (i - l2 + 1);
  }
  for (int i = 1; i <= l1; i++)
    if (!val[i]) val[i] = val[i - 1];
  for (int i = 1; i <= l1; i++) {
    dp[i] = dp[i - 1];
    if (val[i]) dp[i] = (dp[i] + sum[val[i] - 1] + val[i]) % mod;
    sum[i] = (sum[i - 1] + dp[i]) % mod;
  }
  printf("%d\n", dp[l1]);
  return 0;
}
