#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool smin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool smax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const long long N = 1e5 + 100, md = 1e9 + 7, mod = 1e9 + 9, B = 631;
long long n, m, h[N], b[N], thash = 0;
string s, t;
long long dp[N], suf[N];
void fix(long long &x) {
  while (x < 0) x += mod;
  x %= mod;
}
void prep() {
  b[0] = 1;
  for (long long i = 1; i < N; i++) (b[i] = b[i - 1] * B) %= mod;
  h[0] = s[0];
  for (long long i = 1; i < n; i++) (h[i] = h[i - 1] * B + s[i]) %= mod;
  for (long long i = 0; i < m; i++) {
    thash *= B;
    thash += t[i];
    thash %= mod;
  }
}
long long get(long long l, long long r) {
  if (!l) return h[r];
  long long ans = h[r];
  ans -= (h[l - 1] * b[r - l + 1]) % mod;
  fix(ans);
  return ans;
}
int32_t main() {
  cin >> s >> t;
  n = (long long)s.size(), m = (long long)t.size();
  prep();
  long long last = -1;
  for (long long i = n - 1; i >= 0; i--) {
    dp[i] = dp[i + 1];
    if (i + m - 1 < n && get(i, i + m - 1) == thash) last = i + m;
    if (last != -1) {
      dp[i] += suf[last];
      dp[i] += (n - last + 1);
      dp[i] %= md;
    }
    suf[i] = suf[i + 1];
    suf[i] += dp[i];
    suf[i] %= md;
  }
  cout << dp[0] << '\n';
}
