#include <bits/stdc++.h>
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7, base = 41, N = 1000 * 100 + 5;
long long h[N], p[N];
char s[N], t[N];
int f[N], suff[N], was[N], nxt[N], n, m;
int main() {
  int i;
  p[0] = 1;
  for (i = 1; i < N; i++) {
    p[i] = p[i - 1] * base;
  }
  gets(s + 1);
  n = strlen(s + 1);
  gets(t + 1);
  m = strlen(t + 1);
  if (m > n) {
    puts("0");
    return 0;
  }
  h[0] = 0;
  for (i = 1; i <= n; i++) {
    h[i] = h[i - 1] + (s[i] - 'a' + 1) * p[i - 1];
  }
  long long hsh = 0;
  for (i = 1; i <= m; i++) {
    hsh += (t[i] - 'a' + 1) * p[i - 1];
  }
  for (i = 1; i <= n - m + 1; i++) {
    if (hsh * p[n] == (h[i + m - 1] - h[i - 1]) * p[n - i + 1]) {
      was[i] = 1;
    } else {
      was[i] = 0;
    }
  }
  int curr = n + 1;
  for (i = n; i >= 1; i--) {
    if (was[i]) {
      curr = i;
    }
    nxt[i] = curr;
  }
  suff[n + 1] = 1;
  f[n + 1] = 0;
  for (i = n; i >= 1; i--) {
    curr = nxt[i];
    if (curr == n + 1) {
      suff[i] = 1;
      continue;
    }
    f[i] = ((curr - i + 1) * 1ll * suff[curr + m]) % mod;
    f[i] += f[curr + 1];
    f[i] %= mod;
    f[i] += ((curr - i + 1) * 1ll * (n - (curr + m) + 1)) % mod;
    f[i] %= mod;
    suff[i] = (suff[i + 1] + f[i]) % mod;
  }
  printf("%d", f[1]);
  return 0;
}
