#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
char s[SIZE], t[SIZE];
int same[SIZE];
bool suc[SIZE];
long long dp[SIZE], dp2[SIZE];
int main() {
  scanf("%s", (s));
  int n = strlen(s);
  scanf("%s", (t));
  int m = strlen(t);
  strcat(t, s);
  int ll = 0, rr = 0;
  for (int i = (1); i < (n + m); ++i) {
    int st = 0;
    if (i < rr) {
      st = min(same[i - ll], rr - i);
    }
    while (i + st < n + m && t[st] == t[i + st]) st++;
    same[i] = st;
    if (i + st > rr) ll = i, rr = i + st;
    if (i >= m && same[i] >= m) suc[i - 1] = 1;
  }
  ll = SIZE;
  for (int i = 0; i < (n); ++i) {
    if (i)
      dp[i] = dp[i - 1];
    else
      dp[0] = 1;
    if (suc[i]) ll = i - m;
    if (ll <= i) {
      if (ll < 0)
        dp[i] = (dp[i] + 1) % MOD;
      else
        dp[i] = (dp[i] + dp2[ll] + 1) % MOD;
    }
    if (i)
      dp2[i] = (dp[i] + dp2[i - 1]) % MOD;
    else
      dp2[i] = dp[i];
  }
  dp[n - 1]--;
  if (dp[n - 1] < 0) dp[n - 1] += MOD;
  cout << dp[n - 1] << endl;
  return 0;
}
