#include <bits/stdc++.h>
using namespace std;
bool ch[100000 + 100];
void computeLPSArray(char *pat, int M, int *lps) {
  int len = 0;
  lps[0] = 0;
  int 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++;
      }
    }
  }
}
void KMPSearch(char *pat, char *txt) {
  int M = strlen(pat);
  int N = strlen(txt);
  int lps[M];
  computeLPSArray(pat, M, lps);
  int i = 0;
  int j = 0;
  while (i < N) {
    if (pat[j] == txt[i]) {
      j++;
      i++;
    }
    if (j == M) {
      ch[i - j] = true;
      j = lps[j - 1];
    } else if (i < N && pat[j] != txt[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i = i + 1;
    }
  }
}
char txt[100000 + 100], ptrn[100000 + 100];
long long mem[100000 + 100], last;
long long x[100000 + 10];
int main() {
  scanf("%s %s", txt, ptrn);
  KMPSearch(ptrn, txt);
  long long len = strlen(txt);
  long long pl = strlen(ptrn);
  last = -1;
  mem[len] = 1;
  x[len] = 1;
  long long ans = 0;
  for (long long i = len - 1; i >= 0; i--) {
    if (ch[i]) last = i + pl;
    if (last != -1) mem[i] = x[last];
    mem[i] = (mem[i] + mem[i + 1]) % 1000000007;
    x[i] = (x[i + 1] + mem[i]) % 1000000007;
  }
  printf("%I64d", (mem[0] - 1 + 1000000007) % 1000000007);
  printf("\n");
  return 0;
}
