#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 321;
const int MOD = 1000 * 1000 * 1000 + 7;
int lps[MAXN], N, M, dp[MAXN], ps[MAXN], sp[MAXN];
bool good[MAXN];
char txt[MAXN], pat[MAXN];
void computeLPSArray();
void KMPSearch() {
  M = strlen(pat);
  N = strlen(txt);
  computeLPSArray();
  int i = 0;
  int j = 0;
  while (i < N) {
    if (pat[j] == txt[i]) {
      j++;
      i++;
    }
    if (j == M) {
      good[i - j + M - 1] = true;
      j = lps[j - 1];
    } else if (i < N && pat[j] != txt[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i = i + 1;
    }
  }
}
void computeLPSArray() {
  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 DP() {
  int lst = -1, n = N, fst = -1;
  for (int i = 0; i < n; i++) {
    if (good[i]) {
      lst = i - M + 1;
      if (fst == -1) fst = i - M + 1;
    }
    if (~lst) dp[i] = (sp[lst] + lst + 1) % MOD;
    ps[i + 1] = (ps[i] + dp[i]) % MOD;
    sp[i + 1] = (sp[i] + ps[i + 1]) % MOD;
  }
  cout << ps[n];
}
int main() {
  cin >> txt >> pat;
  KMPSearch();
  DP();
  return 0;
}
