#include <bits/stdc++.h>
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T>
inline void gmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline void gmin(T &a, T b) {
  if (b < a) a = b;
}
using namespace std;
const int N = 1e5 + 10, M = 0, Z = 1e9 + 7, maxint = 2147483647,
          ms31 = 522133279, ms63 = 1061109567, ms127 = 2139062143;
const double eps = 1e-8, PI = acos(-1.0);
char a[N], b[N];
int nxt[N];
bool e[N];
int sum[N], all[N];
int n, m;
void getnxt() {
  int j = 0;
  nxt[1] = 0;
  for (int i = 2; i <= m; i++) {
    while (j >= 1 && b[j + 1] != b[i]) j = nxt[j];
    if (b[j + 1] == b[i]) j++;
    nxt[i] = j;
  }
}
void kmp() {
  int j = 0;
  for (int i = 1; i <= n; i++) {
    while (j >= 1 && b[j + 1] != a[i]) j = nxt[j];
    if (b[j + 1] == a[i]) j++;
    if (j == m)
      e[i] = 1;
    else
      e[i] = 0;
  }
}
int dp() {
  int ed = 0;
  for (int i = 1; i <= n; i++) {
    if (e[i]) ed = (all[i - m] + i - m + 1) % Z;
    sum[i] = (sum[i - 1] + ed) % Z;
    all[i] = (all[i - 1] + sum[i]) % Z;
  }
  return sum[n];
}
int main() {
  while (~scanf("%s%s", a + 1, b + 1)) {
    n = strlen(a + 1);
    m = strlen(b + 1);
    getnxt();
    kmp();
    printf("%d\n", dp());
  }
  return 0;
}
