#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1000 + 10, MOD = 1000 * 1000 * 1000 + 7;
int dp[N], ps[N], par_ps[N];
string s, t;
int add(int a, int b) { return (a += b) + MOD * (a < 0) - MOD * (a >= MOD); }
vector<int> kmp(string& s, string& t) {
  int n = s.size(), m = t.size();
  vector<int> res, lps(m);
  for (int i = 1, pl = 0; i < m; i++) {
    while (pl && t[pl] ^ t[i]) pl = lps[--pl];
    lps[i] = pl += t[pl] == t[i];
  }
  for (int i = 0, pl = 0; i < n; i++) {
    while (pl && s[i] ^ t[pl]) pl = lps[--pl];
    pl += s[i] == t[pl];
    if (pl == m) pl = lps[--pl], res.push_back(i);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> s >> t;
  vector<int> ans = kmp(s, t);
  if (ans.empty()) return cout << "0\n", 0;
  for (int i = 0; i < s.size(); i++) {
    int bs = upper_bound(ans.begin(), ans.end(), i) - ans.begin() - 1;
    if (bs == -1) continue;
    int x = ans[bs] - (int)t.size() + 1;
    dp[i] = x + 1;
    if (x) dp[i] = add(dp[i], par_ps[x - 1]);
    if (i) {
      ps[i] = add(ps[i - 1], dp[i]);
      par_ps[i] = add(ps[i], par_ps[i - 1]);
    } else
      ps[0] = par_ps[0] = 1;
  }
  int res = 0;
  for (int i = 0; i < s.size(); i++) res = add(res, dp[i]);
  cout << res << '\n';
}
