#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 10, mod = 1e9 + 7;
int fail[N], tl, sl;
long long dp[2][N], acc[N], ans;
vector<int> ev;
char s[N], t[N];
void kmp() {
  int i, j;
  fail[0] = j = -1;
  for (i = 1; i < tl; i++) {
    while (~j && t[i] != t[j + 1]) j = fail[j];
    if (t[i] == t[j + 1]) j++;
    fail[i] = j;
  }
  j = -1;
  for (i = 0; i < sl; i++) {
    while (~j && s[i] != t[j + 1]) j = fail[j];
    if (s[i] == t[j + 1]) j++;
    if (j == tl - 1) {
      j = fail[j];
      ev.push_back(i);
    }
  }
}
int main() {
  cin >> s >> t;
  tl = strlen(t);
  sl = strlen(s);
  kmp();
  for (int i = 1, j; i <= sl; i++) {
    j = upper_bound(ev.begin(), ev.end(), i - 1) - ev.begin() - 1;
    if (j == -1) continue;
    j = ev[j] - tl + 1;
    dp[0][i] = acc[j] + j + 1;
    dp[1][i] = (dp[1][i - 1] + dp[0][i]) % mod;
    acc[i] = (acc[i - 1] + dp[1][i]) % mod;
  }
  cout << dp[1][sl] << endl;
  return 0;
}
