#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long mod = 1e9 + 7;
vector<long long> prefix(string s) {
  long long n = s.size();
  vector<long long> p(n);
  p[0] = 0;
  for (long long i = 1; i < n; ++i) {
    long long j = p[i - 1];
    while (j > 0 && s[i] != s[j]) j = p[j - 1];
    if (s[i] == s[j]) p[i] = ++j;
  }
  return p;
}
void solve() {
  string s, t;
  cin >> s >> t;
  string search = t + '#' + s;
  vector<long long> pre = prefix(search);
  long long m = t.size() + 1;
  long long n = s.size();
  vector<long long> isGood(n + 1);
  vector<long long> dp(n + 1), sum(n + 1), ans(n + 1);
  for (long long i = m; i < m + n; ++i) {
    isGood[i - (m) + 1] = (pre[i] == m - 1);
  };
  for (long long i = 1; i <= n; ++i) {
    if (isGood[i]) {
      dp[i] = i - (m - 1) + 1;
      if (i - (m - 1) > 0) dp[i] += sum[i - (m - 1)];
      dp[i] %= mod;
    } else {
      dp[i] = dp[i - 1];
    }
    ans[i] = ans[i - 1] + dp[i];
    ans[i] %= mod;
    sum[i] = sum[i - 1] + ans[i];
    sum[i] %= mod;
  }
  cout << ans[n] << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) solve();
}
