#include <bits/stdc++.h>
using namespace std;
long long modx(long long Base, long long exponent) {
  long long ans = 1;
  if (Base == 1) return Base;
  while (exponent) {
    if (exponent & 1) ans = (ans * Base) % 1000000007LL;
    Base = (Base * Base) % 1000000007LL;
    exponent = exponent >> 1;
  }
  return ans;
}
long long inmodx(long long num) { return (modx(num, 1000000007LL - 2LL)); }
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return (a.first * a.second >= b.first * b.second);
}
const int N = (2e5) + 9;
const int M = (N << 2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 600;
int Z[N];
vector<int> match_indices;
void build_z_array(string s) {
  int i, n = s.length(), l, r, k;
  l = r = 0;
  Z[0] = n;
  for (i = (1); i < (n); i++) {
    if (i > r) {
      l = r = i;
      while (r < n && s[r - l] == s[r]) r++;
      Z[i] = r - l;
      r--;
    } else {
      k = i - l;
      if (Z[k] < r - i + 1)
        Z[i] = Z[k];
      else {
        l = i;
        while (r < n && s[r - l] == s[r]) r++;
        Z[i] = r - l;
        r--;
      }
    }
  }
  return;
}
int pattern_search(string pattern, string text) {
  match_indices.clear();
  string s = pattern + text;
  build_z_array(s);
  int l_pattern = pattern.length(), l_s = s.length(), i, count_ = 0;
  for (i = (l_pattern); i < (l_s); i++) {
    if (Z[i] >= l_pattern) {
      count_++;
      match_indices.push_back(i - l_pattern);
    }
  }
  return count_;
}
string s, t;
bool mark[N];
long long dp[N], sum[N], sum2[N];
void solve() {
  int n, i, m, j;
  cin >> s >> t;
  n = s.length();
  m = t.length();
  pattern_search(t, s);
  for (auto x : match_indices) mark[x + m - 1] = 1;
  j = 1000000011;
  for (i = (0); i < (n); i++) {
    if (mark[i]) j = i - m + 1;
    if (j < 1000000011) {
      dp[i] = j + 1;
      if (j > 0) dp[i] = (dp[i] + sum2[j - 1]) % 1000000007LL;
      sum[i] = (i == 0) ? dp[i] : (sum[i - 1] + dp[i]) % 1000000007LL;
      sum2[i] = (i == 0) ? sum[i] : (sum2[i - 1] + sum[i]) % 1000000007LL;
    }
  }
  cout << sum[n - 1] << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1, cs;
  cout << fixed << setprecision(9);
  for (cs = (1); cs < (t + 1); cs++) {
    solve();
  }
  return 0;
}
