#include <bits/stdc++.h>
using namespace std;
long long int n, a[400007], a1[400007], i, d[400007], m, t0[400007],
    mod = 1e9 + 7, kk = 0, b[400007];
char c[400007];
string s, p;
void solve() {
  s.clear();
  p.clear();
  for (i = 0; i < 400007; i++) {
    a[i] = 0;
    d[i] = 0;
    t0[i] = 0;
    b[i] = 0;
  }
  kk = 0;
  long long int j, k = 0, kol = 0, l = 0, r = 0, kolt = 1, plu = 0, stop = 0;
  s = c;
  gets(c);
  p = c;
  m = p.length();
  p += "#";
  s = p + s;
  n = s.length();
  for (i = 1; i < n; i++) {
    if (r >= i) {
      d[i] = min(d[i - l], r - i + 1);
    }
    while (d[i] + i < n && s[d[i] + i] == s[d[i]]) {
      d[i]++;
    }
    if (r < d[i] + i - 1) {
      l = i;
      r = d[i] + i - 1;
    }
  }
  for (i = 0; i < n; i++) {
    if (d[i] == m) {
      t0[kolt] = i;
      kolt++;
    }
  }
  if (kolt == 1) {
    printf("0\n");
    return;
  }
  t0[0] = 0;
  for (i = t0[1] + m - 1; i < n; i++) {
    if (i >= t0[k + 1] + m - 1 && stop == 0) {
      k++;
      if (k == kolt - 1) {
        stop = 1;
      }
      if (k >= kolt) {
        k--;
      }
      a[i] = kk;
      for (j = t0[k - 1]; j < t0[k]; j++) {
        a[i] += b[j];
        a[i] = a[i] % mod;
      }
      kk = a[i];
      a[i] = (a[i] + t0[k] - m + mod) % mod;
      b[i] = (b[i - 1] + a[i]) % mod;
    } else {
      a[i] = a[i - 1];
      b[i] = (b[i - 1] + a[i]) % mod;
    }
  }
  for (i = m; i < n; i++) {
    kol += a[i];
    kol = kol % mod;
  }
  printf("%I64d\n", kol);
}
int main() {
#pragma comment(linker, "/STACK:67108864")
  while (gets(c)) {
    solve();
  }
  return 0;
}
