#include <bits/stdc++.h>
using namespace std;
char s[100100], t[100100];
int f[100100], h[100100];
void prepare(char *p) {
  int m = strlen(p + 1);
  h[1] = 0;
  for (int i = 2, j = 0; i <= m; i++) {
    while (j && p[j + 1] != p[i]) j = h[j];
    if (p[j + 1] == p[i]) j++;
    h[i] = j;
  }
  return;
}
void kmp_matching(char *t, char *p, int *f) {
  int n = strlen(t + 1), m = strlen(p + 1);
  for (int i = 1, j = 0; i <= n; i++) {
    while (j && t[i] != p[j + 1]) j = h[j];
    if (t[i] == p[j + 1]) j++;
    f[i] = j;
    if (j == m) j = h[m];
  }
  return;
}
int dp[100100][2], ep[100100], fp[100100];
const int mod = 1e9 + 7;
inline void add(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}
int main() {
  scanf("%s %s", s + 1, t + 1);
  prepare(t);
  kmp_matching(s, t, f);
  int n = strlen(s + 1), l = strlen(t + 1);
  for (int i = 1; i <= n; i++) {
    dp[i][0] = dp[i][1] = dp[i - 1][1];
    add(dp[i][0], dp[i - 1][0]);
    if (f[i] == l) {
      int m = i - l;
      dp[i][1] = (m + 1 + 1ll * (m + 1) * ep[m] - fp[m] + mod) % mod;
    }
    ep[i] = ep[i - 1];
    add(ep[i], dp[i][1]);
    fp[i] = (fp[i - 1] + 1ll * i * dp[i][1]) % mod;
  }
  add(dp[n][0], dp[n][1]);
  printf("%d\n", dp[n][0]);
  return 0;
}
