#include <bits/stdc++.h>
using namespace std;
char T[100005], S[100050];
int n, m, x, y, z, k, w;
int F[100005], FAIL[100005];
long long DP[100005], A[100005], sum[100005], B[100005], MOD = 1000000007LL;
int main() {
  scanf("%s", &S);
  scanf("%s", &T);
  n = strlen(T);
  FAIL[0] = -1;
  for (int i = (1); i < (n); i++) {
    x = FAIL[i - 1];
    while (T[x + 1] != T[i] && x != -1) x = FAIL[x];
    if (T[x + 1] == T[i])
      FAIL[i] = x + 1;
    else
      FAIL[i] = -1;
  }
  m = strlen(S);
  x = -1;
  for (int i = (0); i < (m); i++) {
    while (S[i] != T[x + 1] && x != -1) x = FAIL[x];
    if (S[i] == T[x + 1]) x++;
    A[i] = x;
  }
  if (A[0] == n - 1) {
    B[0] = 1LL;
    sum[0] = 1LL;
  }
  for (int i = (1); i < (m); i++) {
    if (A[i] != n - 1) {
      DP[i] = (DP[i - 1] + B[i - 1]) % MOD;
      B[i] = B[i - 1] % MOD;
    } else {
      DP[i] = (B[i - 1] + DP[i - 1]) % MOD;
      B[i] = (long long)(i - n + 2LL) + sum[i - n];
    }
    sum[i] = (sum[i - 1] + DP[i] + B[i]) % MOD;
  }
  printf("%I64d\n", (DP[m - 1] + B[m - 1]) % MOD);
  return 0;
}
