#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
const int MM = 998244353;
const long double PI = acos(-1);
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
template <typename T, typename U>
static inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  return os << '(' << p.first << "," << p.second << ')';
}
const int N = 100005;
vector<int> zFunction(string &s) {
  int n = (long long)s.size(), l, r, i;
  vector<int> z(n);
  z[0] = n;
  l = r = 0;
  for (i = 1; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[z[i] + i]) ++z[i];
    if (i + z[i] - 1 > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  return z;
}
int _runtimeTerror_() {
  string s, t;
  cin >> s >> t;
  int n = (long long)s.size(), m = (long long)t.size();
  string u = t + "#" + s;
  vector<int> z = zFunction(u);
  vector<int> start(n + 10, false);
  for (int i = m + 1; i < n + m + 1; ++i) {
    if (z[i] == m) start[i - m - 1] = 1;
  }
  int last = -1;
  long long ans = 0;
  vector<long long> suf(n + 10, 0);
  vector<long long> val(n + 10, 0);
  suf[n + 1] = 0;
  val[n + 1] = 0;
  for (int i = n - 1; i >= 0; --i) {
    suf[i] = suf[i + 1];
    val[i] = val[i + 1] + suf[i];
    if (start[i] == 1) last = i;
    if (last == -1) continue;
    long long u = (n - 1 - (last + m - 1) + 1);
    val[i] += u;
    val[i] %= M;
    suf[i] += u;
    suf[i] %= M;
    ans += u;
    ans %= M;
    suf[i] += val[last + m];
    suf[i] %= M;
    val[i] += val[last + m];
    val[i] %= M;
    ans += val[last + m];
    ans %= M;
  }
  cout << ans << "\n";
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) _runtimeTerror_();
  return 0;
}
