#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1e9 + 7;
const long long Max = 1e6 + 10;
int f[Max];
int lastStart[Max];
long long dp[Max];
long long dpx[Max];
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  for (int i = 1; i < m; i++) {
    int state = f[i];
    while (state && t[state] != t[i]) state = f[state];
    if (t[state] == t[i]) state++;
    f[i + 1] = state;
  }
  int state = 0;
  lastStart[0] = -1;
  for (int i = 0; i < n; i++) {
    while (state && t[state] != s[i]) state = f[state];
    if (t[state] == s[i]) state++;
    if (state == m) {
      lastStart[i + 1] = i - m + 1;
      state = f[state];
    } else
      lastStart[i + 1] = lastStart[i];
  }
  for (int i = 1; i <= n; i++) {
    if (lastStart[i] > -1) {
      dp[i] = dp[i - 1] + dpx[lastStart[i]] + lastStart[i] + 1;
      dp[i] %= Mod;
      dpx[i] = dpx[i - 1] + dp[i];
      dpx[i] %= Mod;
    }
  }
  cout << '\n';
  for (int i = 0; i <= n; i++) {
  }
  cout << dp[n];
}
