#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, mod = 1e9 + 7;
int dp[N], sum[N], i, n, m, j, k, nxt[N], v[N];
char a[N], b[N];
int main() {
  for (scanf("%s%s", a + 1, b + 1), n = strlen(a + 1), m = strlen(b + 1), i = 2;
       i <= m; ++i) {
    while (b[j + 1] != b[i] && j) j = nxt[j];
    if (b[j + 1] == b[i]) j++;
    nxt[i] = j;
  }
  for (i = 1, j = 0; i <= n; ++i) {
    while (b[j + 1] != a[i] && j) j = nxt[j];
    if (b[j + 1] == a[i]) j++;
    if (j == m) v[i] = 1, j = nxt[j];
  }
  for (i = 1, j = -1; i <= n; ++i) {
    dp[i] = dp[i - 1];
    if (v[i]) j = i - m + 1;
    if (j != -1) dp[i] += sum[j - 1] + j, dp[i] %= mod;
    sum[i] = (sum[i - 1] + dp[i]) % mod;
  }
  return 0 * printf("%d\n", dp[n]);
}
