#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 9, MOD = 1e9 + 7;
long long pi[N], dp[N], ps[N], lst[N];
void KMP(string s) {
  long long n = s.size();
  for (long long i = 1; i < n; i++) {
    pi[i] = pi[i - 1];
    while (pi[i] > 0 && s[pi[i]] != s[i]) pi[i] = pi[pi[i] - 1];
    if (s[i] == s[pi[i]]) pi[i]++;
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  long long n = s.size(), m = t.size();
  KMP(t + '#' + s);
  lst[m] = m;
  ps[m] = dp[m] = 1;
  for (long long i = m + 1; i <= n + m; i++) {
    lst[i] = lst[i - 1];
    if (pi[i] == m) lst[i] = i - m + 1;
    dp[i] = (dp[i - 1] + ps[lst[i] - 1]) % MOD;
    ps[i] = (ps[i - 1] + dp[i]) % MOD;
  }
  cout << (dp[n + m] - 1 + MOD) % MOD;
  return 0;
}
