#include <bits/stdc++.h>
using namespace std;
vector<int> p;
int *computeLPSArray(string &pat, int M) {
  int len = 0, i;
  int *lps = (int *)malloc(M * sizeof(int));
  lps[0] = 0;
  i = 1;
  while (i < M) {
    if (pat[i] == pat[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len != 0) {
        len = lps[len - 1];
      } else {
        lps[i] = 0;
        i++;
      }
    }
  }
  return lps;
}
void KMPSearch(string &pat, string &txt) {
  int M = pat.length();
  int N = txt.length();
  int *lps = computeLPSArray(pat, M);
  int i = 0, j = 0;
  while (i < N) {
    if (pat[j] == txt[i]) {
      i++;
      j++;
    }
    if (j == M) {
      p[i - j] = 1;
      j = lps[j - 1];
    } else if (pat[j] != txt[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i++;
    }
  }
}
int main() {
  int mod = 1e9 + 7;
  string s, t;
  cin >> s >> t;
  int n = s.length(), m = t.length();
  p.resize(n + 1, -1);
  KMPSearch(t, s);
  for (int i = (int)n - 1; i >= 0; --i) p[i] = (p[i] == 1 ? i : p[i + 1]);
  vector<int> f(n + 1, 0), g(n + 1, 0), h(n + 1, 0);
  for (int i = n - 1; i >= 0; --i) {
    if (p[i] == -1)
      f[i] = 0;
    else {
      f[i] = h[p[i] + m] + n + 1 - p[i] - m;
      if (f[i] >= mod) f[i] -= mod;
      if (f[i] < 0) f[i] += mod;
    }
    g[i] = f[i] + g[i + 1];
    if (g[i] >= mod) g[i] -= mod;
    h[i] = g[i] + h[i + 1];
    if (h[i] >= mod) h[i] -= mod;
  }
  cout << g[0];
}
