#include <bits/stdc++.h>
using namespace std;
int z[2 * 100005];
void z_algo(char *s) {
  int l = 0, r = 0;
  for (int i = 0; s[i]; i++) {
    if (i > r) {
      l = r = i;
      for (; s[r] == s[r - l]; r++)
        ;
      z[i] = r-- - l;
    } else if (z[i - l] < r - i + 1) {
      z[i] = z[i - l];
    } else {
      l = i;
      for (r++; s[r] == s[r - l]; r++)
        ;
      z[i] = r-- - l;
    }
  }
}
int n, m;
char s[100005], t[100005], ts[2 * 100005];
int init[100005], nextt[100005];
int dp[100005], acum[100005];
int main() {
  scanf("%s %s", s, t);
  n = strlen(s);
  m = strlen(t);
  strcpy(ts, t);
  strcat(ts, "#");
  strcat(ts, s);
  z_algo(ts);
  memset(init, 0, sizeof(init));
  for (int i = m + 1; ts[i]; i++)
    if (z[i] == m) init[i - m - 1] = 1;
  nextt[n] = n;
  for (int i = n - 1; i >= 0; i--) {
    nextt[i] = nextt[i + 1];
    if (init[i]) nextt[i] = i;
  }
  dp[n] = acum[n] = 1;
  for (int i = n - 1; i >= 0; i--) {
    dp[i] = dp[i + 1];
    if (nextt[i] < n) dp[i] = (dp[i] + acum[nextt[i] + m]) % 1000000007;
    acum[i] = (acum[i + 1] + dp[i]) % 1000000007;
  }
  printf("%d\n", (dp[0] - 1 + 1000000007) % 1000000007);
}
