#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
string txt, pat;
int N, M;
int lps[100005];
vector<int> locations;
int dp[100005];
void precomp_LPS() {
  int len = 0;
  lps[0] = 0;
  for (int i = 1; i < M;) {
    if (pat[i] == pat[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len)
        len = lps[len - 1];
      else {
        lps[i] = 0;
        i++;
      }
    }
  }
}
void KMP() {
  precomp_LPS();
  int i = 0;
  int j = 0;
  while (i < N) {
    if (pat[j] == txt[i]) {
      j++;
      i++;
    }
    if (j == M) {
      locations.push_back(i - j);
      j = lps[j - 1];
    } else if (pat[j] != txt[i] && i < N) {
      if (j)
        j = lps[j - 1];
      else
        i++;
    }
  }
}
int main() {
  cin >> txt >> pat;
  N = txt.size();
  M = pat.size();
  KMP();
  for (int i = 0; i < locations.size(); i++) locations[i]++;
  txt = "#" + txt;
  pat = "#" + pat;
  dp[0] = 1;
  int cum = 1;
  int cum_loc = 0;
  for (int i = 1; i <= N; i++) {
    dp[i] = dp[i - 1];
    auto it = upper_bound(locations.begin(), locations.end(), i - M + 1);
    if (it == locations.begin()) continue;
    int must_go_back_to = *--it;
    while (cum_loc < must_go_back_to - 1) {
      cum += dp[cum_loc + 1];
      cum %= MOD;
      cum_loc++;
    }
    dp[i] += cum;
    dp[i] %= MOD;
  }
  cout << (dp[N] - 1 + MOD) % MOD;
}
