#include <bits/stdc++.h>
using namespace std;
char a[2000056];
char b[2000005];
int pi[2000005];
int fir[2000005], sec[2000005], res[2000005];
;
int main() {
  int n, m;
  scanf("%s%s", &b, &a);
  m = strlen(b);
  int l = strlen(a);
  a[l] = '@';
  strcpy(a + l + 1, b);
  n = m + l + 1;
  a[n] = 0;
  int i, j;
  for (i = 1; i < n; i++) {
    j = pi[i - 1];
    while (j > 0 && a[i] != a[j]) j = pi[j - 1];
    if (a[i] == a[j]) j++;
    pi[i] = j;
  }
  int ans = 0;
  int mo = 1000000007;
  res[0] = fir[0] = sec[0] = 0;
  for (j = l + 1; j <= n; j++) {
    if (pi[j - 1] == l) {
      i = j - l - 1;
      res[i] = i - l + 1 + sec[i - l];
    } else {
      i = j - l - 1;
      res[i] = res[i - 1];
    }
    i = j - l - 1;
    res[i] %= mo;
    fir[i] = (fir[i - 1] + res[i]) % mo;
    sec[i] = (sec[i - 1] + fir[i]) % mo;
  }
  ans = 0;
  for (i = 0; i <= n; i++) ans = (ans + res[i]) % mo;
  cout << (mo + ans) % mo;
  return 0;
}
